Selection
Pick the component by how the value is chosen. A select holds a known set of values. A combobox searches that set. Autocomplete accepts any text and only suggests values. A listbox keeps its options on screen. Each example imports from @nyxwire/vue and has its own NwProvider.
The tables list wrapper props and overrides only. Each root adds class to its Reka root interface and forwards the rest, including v-model through update:modelValue. Every part takes a class (HTMLAttributes['class'], unset by default) that is merged with tailwind-merge. Size and invalid props belong to the trigger, input or filter, not to the root. Popup content is portalled to <body> and uses the page’s flavor.
NwSelect
Section titled “NwSelect”NwSelect wraps Reka SelectRoot. The trigger shows the current value. The content brings its own portal, viewport and scroll buttons. Reka renders a hidden native <select> for a named root, so NwSelect passes Reka an empty name and submits the value through hidden inputs instead, one per selected value.
Active zone: arc
<script setup lang="ts">import { ref, useId } from 'vue'import { NwLabel, NwProvider, NwSelect, NwSelectContent, NwSelectGroup, NwSelectItem, NwSelectLabel, NwSelectSeparator, NwSelectTrigger, NwSelectValue,} from '@nyxwire/vue'
const zone = ref('arc')const id = useId()</script>
<template> <NwProvider> <div class="w-full max-w-sm space-y-2"> <NwLabel :for="id">Routing zone</NwLabel> <NwSelect v-model="zone" name="zone"> <NwSelectTrigger :id="id"><NwSelectValue placeholder="Choose a zone" /></NwSelectTrigger> <NwSelectContent aria-label="Routing zones"> <NwSelectGroup> <NwSelectLabel>Reachable</NwSelectLabel> <NwSelectItem value="arc">Arc district</NwSelectItem> <NwSelectItem value="circuit">Circuit district</NwSelectItem> <NwSelectItem value="flare" disabled>Flare district (locked)</NwSelectItem> </NwSelectGroup> <NwSelectSeparator /> <NwSelectItem value="steel">Steel perimeter</NwSelectItem> </NwSelectContent> </NwSelect> <p class="text-sm text-fg-muted" role="status">Active zone: {{ zone }}</p> </div> </NwProvider></template>Anatomy
Section titled “Anatomy”<NwSelect> <NwSelectTrigger><NwSelectValue /></NwSelectTrigger> <NwSelectContent> <NwSelectGroup> <NwSelectLabel /> <NwSelectItem value="arc" /> </NwSelectGroup> <NwSelectSeparator /> <NwSelectItem value="steel" /> </NwSelectContent></NwSelect>NwSelectContent renders NwSelectScrollUpButton and NwSelectScrollDownButton itself. Both are also exported for custom content.
| Component / prop | Type | Default | Effect |
|---|---|---|---|
Root class |
HTMLAttributes['class'] |
unset | Accepted by the interface; the root is renderless, so style parts |
Root name |
string |
field name | Hidden input name; falls back to the surrounding NwField |
Trigger size |
'sm' | 'md' | 'lg' |
'md' |
Trigger height and padding |
Trigger invalid |
boolean |
false |
Danger edge and aria-invalid |
Content position |
SelectContentProps['position'] |
'popper' |
'popper' or 'item-aligned' positioning |
Content sideOffset |
number |
4 |
Distance from the trigger in popper mode |
Content portalProps |
SelectPortalProps |
unset | Portal configuration, including the destination |
In popper mode the content is at least as wide as the trigger and is capped at the available height. A disabled root, or a disabled surrounding field, disables the hidden inputs too.
Keyboard and accessibility. Label NwSelectTrigger with a <label for> or aria-label, because the placeholder is not its accessible name. ArrowDown, Enter or Space opens the list. Arrow keys move through the options and skip disabled ones. Typing jumps to a matching option, and Enter selects the highlighted one. Escape closes the list and returns focus to the trigger, which leaves the tab order while the list is open. The trigger exposes aria-expanded and the selected option exposes aria-selected.
NwCombobox
Section titled “NwCombobox”NwCombobox wraps Reka ComboboxRoot so the user can search item text to choose a value. The model holds the selected item, or the selected items with multiple. The search text in the input is separate.
Endpoint: None
<script setup lang="ts">import { ref } from 'vue'import { NwCombobox, NwComboboxAnchor, NwComboboxCancel, NwComboboxContent, NwComboboxEmpty, NwComboboxGroup, NwComboboxInput, NwComboboxItem, NwComboboxLabel, NwComboboxSeparator, NwComboboxTrigger, NwProvider, type NwComboboxProps,} from '@nyxwire/vue'
const endpoints = ['Arc relay', 'Circuit hub', 'Matrix node'] as constconst endpoint = ref<NwComboboxProps['modelValue']>(null)</script>
<template> <NwProvider> <div class="w-full max-w-sm space-y-2"> <NwCombobox v-model="endpoint"> <NwComboboxAnchor> <NwComboboxInput aria-label="Endpoint" placeholder="Search endpoints" /> <NwComboboxCancel label="Clear endpoint" /> <NwComboboxTrigger label="Show endpoints" /> </NwComboboxAnchor> <NwComboboxContent aria-label="Endpoints"> <NwComboboxGroup> <NwComboboxLabel>Reachable</NwComboboxLabel> <NwComboboxItem v-for="node in endpoints" :key="node" :value="node">{{ node }}</NwComboboxItem> </NwComboboxGroup> <NwComboboxSeparator /> <NwComboboxGroup> <NwComboboxLabel>Offline</NwComboboxLabel> <NwComboboxItem value="Ice relay" disabled>Ice relay</NwComboboxItem> </NwComboboxGroup> <NwComboboxEmpty>No matching endpoints.</NwComboboxEmpty> </NwComboboxContent> </NwCombobox> <p class="text-sm text-fg-muted" role="status">Endpoint: {{ endpoint ?? 'None' }}</p> </div> </NwProvider></template>Anatomy
Section titled “Anatomy”<NwCombobox> <NwComboboxAnchor> <NwComboboxInput /> <NwComboboxCancel /> <NwComboboxTrigger /> </NwComboboxAnchor> <NwComboboxContent> <NwComboboxGroup> <NwComboboxLabel /> <NwComboboxItem value="Arc relay" /> </NwComboboxGroup> <NwComboboxSeparator /> <NwComboboxEmpty /> </NwComboboxContent></NwCombobox>| Component / prop | Type | Default | Effect |
|---|---|---|---|
Root class |
HTMLAttributes['class'] |
unset | Merged root styling; other props are ComboboxRootProps |
Input size |
'sm' | 'md' | 'lg' |
'md' |
Input height and padding |
Input invalid |
boolean |
false |
Danger edge and aria-invalid |
Trigger label |
string |
'Show options' |
Accessible name of the chevron button |
Cancel label |
string |
'Clear selection' |
Accessible name of the clear button |
Content position |
ComboboxContentProps['position'] |
'popper' |
Popup positioning mode |
Content sideOffset |
number |
4 |
Distance from the anchor |
Content align |
ComboboxContentProps['align'] |
'start' |
Popup alignment |
Content portalProps |
ComboboxPortalProps |
unset | Portal configuration |
For several selections, set multiple on the root and use an array model. Items filter on their text, and NwComboboxEmpty shows when nothing matches. Selected items show a check. Items under a disabled root carry aria-disabled.
Keyboard and accessibility. Label the input. When several comboboxes share a page, give each clear and show button its own name. ArrowDown opens the list and moves through it, and Enter selects the highlighted item. Escape closes the list and keeps focus on the input. The input exposes aria-expanded, and items expose their selected and disabled states.
NwAutocomplete
Section titled “NwAutocomplete”NwAutocomplete wraps Reka AutocompleteRoot. Its v-model is the typed string, so text that matches no suggestion is still a valid value. Choosing a suggestion fills the text in.
Destination: Not set
<script setup lang="ts">import { ref } from 'vue'import { NwAutocomplete, NwAutocompleteAnchor, NwAutocompleteCancel, NwAutocompleteContent, NwAutocompleteEmpty, NwAutocompleteGroup, NwAutocompleteInput, NwAutocompleteItem, NwAutocompleteLabel, NwAutocompleteTrigger, NwProvider,} from '@nyxwire/vue'
const districts = ['Arc district', 'Circuit district', 'Flux district'] as constconst destination = ref('')</script>
<template> <NwProvider> <div class="w-full max-w-sm space-y-2"> <NwAutocomplete v-model="destination"> <NwAutocompleteAnchor> <NwAutocompleteInput aria-label="Route destination" placeholder="Enter a destination" /> <NwAutocompleteCancel label="Clear destination" /> <NwAutocompleteTrigger label="Show destinations" /> </NwAutocompleteAnchor> <NwAutocompleteContent aria-label="Destinations"> <NwAutocompleteGroup> <NwAutocompleteLabel>Districts</NwAutocompleteLabel> <NwAutocompleteItem v-for="item in districts" :key="item" :value="item">{{ item }}</NwAutocompleteItem> </NwAutocompleteGroup> <NwAutocompleteEmpty>No suggestions. Your typed destination is kept.</NwAutocompleteEmpty> </NwAutocompleteContent> </NwAutocomplete> <p class="text-sm text-fg-muted" role="status">Destination: {{ destination || 'Not set' }}</p> </div> </NwProvider></template>Anatomy
Section titled “Anatomy”<NwAutocomplete> <NwAutocompleteAnchor> <NwAutocompleteInput /> <NwAutocompleteCancel /> <NwAutocompleteTrigger /> </NwAutocompleteAnchor> <NwAutocompleteContent> <NwAutocompleteGroup> <NwAutocompleteLabel /> <NwAutocompleteItem value="Arc district" /> </NwAutocompleteGroup> <NwAutocompleteSeparator /> <NwAutocompleteEmpty /> </NwAutocompleteContent></NwAutocomplete>| Component / prop | Type | Default | Effect |
|---|---|---|---|
Root class |
HTMLAttributes['class'] |
unset | Root styling; remaining props/emits are AutocompleteRootProps/emits |
Input size |
'sm' | 'md' | 'lg' |
'md' |
Input height and padding |
Input invalid |
boolean |
false |
Danger edge and aria-invalid |
Trigger label |
string |
'Show options' |
Accessible name of the chevron button |
Cancel label |
string |
'Clear selection' |
Accessible name of the clear button |
Content position |
ComboboxContentProps['position'] |
'popper' |
Positioning mode |
Content sideOffset |
number |
4 |
Distance from the anchor |
Content align |
ComboboxContentProps['align'] |
'start' |
Alignment |
Content portalProps |
ComboboxPortalProps |
unset | Portal destination and options |
Autocomplete takes free text and cannot hold several values. NwAutocompleteEmpty explains that nothing matched and still lets the user keep a custom value. A suggestion is a hint, not a validation. If the text has to name a real record, resolve and check it where the form is submitted.
Keyboard and accessibility. ArrowDown opens the suggestions, and Enter chooses the highlighted one. Escape closes the list and keeps the typed text. The clear button empties the text and returns focus to the input. Label the input, and use the placeholder only as a hint.
NwListbox
Section titled “NwListbox”NwListbox wraps Reka ListboxRoot for a list that stays visible. NwListboxFilter only holds the query text: you filter your own array with it, as this example does.
Allowed: TLS
<script setup lang="ts">import { computed, ref } from 'vue'import { NwListbox, NwListboxContent, NwListboxFilter, NwListboxGroup, NwListboxGroupLabel, NwListboxItem, NwProvider, type NwListboxProps,} from '@nyxwire/vue'
const protocols = ['TCP', 'TLS', 'QUIC', 'WebSocket'] as constconst allowed = ref<NwListboxProps['modelValue']>(['TLS'])const query = ref('')const matches = computed(() => protocols.filter((protocol) => protocol.toLowerCase().includes(query.value.toLowerCase())),)const summary = computed(() => Array.isArray(allowed.value) ? allowed.value.join(', ') || 'None' : String(allowed.value),)</script>
<template> <NwProvider> <div class="w-full max-w-sm space-y-2"> <NwListbox v-model="allowed" multiple> <NwListboxFilter v-model="query" aria-label="Filter protocols" placeholder="Filter protocols" /> <NwListboxContent aria-label="Allowed protocols"> <NwListboxGroup> <NwListboxGroupLabel>Transports</NwListboxGroupLabel> <NwListboxItem v-for="protocol in matches" :key="protocol" :value="protocol">{{ protocol }}</NwListboxItem> </NwListboxGroup> </NwListboxContent> <p v-if="matches.length === 0" role="status" class="text-sm text-fg-muted"> No transports match. </p> </NwListbox> <p class="text-sm text-fg-muted" data-testid="allowed">Allowed: {{ summary }}</p> </div> </NwProvider></template>Anatomy
Section titled “Anatomy”<NwListbox> <NwListboxFilter /> <NwListboxContent> <NwListboxGroup> <NwListboxGroupLabel /> <NwListboxItem value="TLS" /> </NwListboxGroup> </NwListboxContent></NwListbox>| Component / prop | Type | Default | Effect |
|---|---|---|---|
Root class |
HTMLAttributes['class'] |
unset | Root styling; other props/emits are ListboxRootProps/emits |
Filter size |
'sm' | 'md' | 'lg' |
'md' |
Filter height and padding |
Filter invalid |
boolean |
false |
Danger edge and aria-invalid |
The root’s v-model holds the selected values and the filter’s v-model holds the query. With multiple, the root model is an array, clicking an option toggles it, and the list exposes aria-multiselectable. A disabled root blocks selection and marks every item aria-disabled. Selected items show a check.
Keyboard and accessibility. Name the content and the filter separately. The options are always in the document, so there is no popup and no focus trap. Arrow keys move the highlight, Enter or Space selects it, and typing jumps to a match. Keep focus in the filter while the user types, and show a visible message when the filter matches nothing, as the example does.