Skip to content

Select

Last updated 24 Nov 2026

NbSelect is a custom dropdown that replaces the native <select>. It shares the same design language as NbTextInput: two variants (default / fluid), error/warning states, multi-select support, and full keyboard navigation.

Variants ​

Default ​

The label sits above the field. Helper/error/warning messages appear below.

Fluid ​

The label sits inside the field. While nothing is chosen it rests where a placeholder would be, and once an option is chosen, or the control has focus, it steps up and shrinks above the value. The field keeps the height of its size, so a fluid select lines up with every other control of that size. That makes it the select for a filter bar or a toolbar, where a label above the field has no room.

At sm (32px) in a filter bar. The first select is empty, the second has a value:

vue
<NbSelect
  v-model="language"
  variant="fluid"
  size="sm"
  label="Language"
  :options="languages"
  clearable
/>

A floated label and its value need two lines, which 24px cannot hold, so a fluid field draws xs at sm. The label moves on transform on the quick motion step, and with reduced motion it moves without travel.

vue
<template>
  <NbSelect
    v-model="value"
    variant="fluid"
    label="Status"
    :options="statusOptions"
  />
</template>

Multi-select ​

Set :multiple="true" and bind to an array. The trigger displays the item label when 1 is selected, a comma-separated list for 2, and N selected for 3 or more.

vue
<template>
  <NbSelect
    v-model="selected"
    label="Target locales"
    :options="localeOptions"
    :multiple="true"
  />
</template>

<script setup lang="ts">
import { ref } from 'vue'
const selected = ref<string[]>([])
</script>

Groups ​

Give options a group and the ones that share it, consecutively, are drawn under one heading. Reach for it when a value only means something under a field name: 1.12.0 says nothing on its own, 1.12.0 under Fixes version says what it answers.

vue
<script setup lang="ts">
const options = [
  { label: '1.9.0', value: 'aff-190', group: 'Affects version' },
  { label: '1.11.0', value: 'aff-1110', group: 'Affects version' },
  { label: '1.12.0', value: 'aff-1120', group: 'Affects version' },
  { label: '1.9.0', value: 'fix-190', group: 'Fixes version' },
  { label: '1.12.0', value: 'fix-1120', group: 'Fixes version' },
]
</script>

<template>
  <NbSelect v-model="version" label="Version" :options="options" />
</template>

Three things worth knowing:

  • The order you give is the order you get. A new heading starts wherever the group name changes, so options are never collected together behind your back. 1.9.0 before 1.11.0 stays that way, which alphabetical sorting would undo, and the same name appearing twice is two headings.
  • Two options may share a label. They are told apart by value, so a versions list where both groups hold 1.12.0 works without inventing prefixes.
  • A heading is not an option. It carries no role="option", the arrow keys pass straight over it, and it is not selectable by any means. Faking one with a disabled option gives a screen reader a choice it may not make and costs a keystroke on the way past.

Mixing is fine: options without a group render as plain rows, and a list where none of them has one is unchanged.

Clearable ​

Set clearable on an optional select to show a clear button in the trigger while a value is selected. It clears the selection to null (or [] with multiple), emits change, and returns focus to the select. It is hidden while nothing is selected and when the select is disabled. Use it instead of a "None" option.

vue
<template>
  <NbSelect
    v-model="assignee"
    label="Assignee"
    placeholder="Unassigned"
    :options="options"
    clearable
  />
</template>

The button is a ghost, icon-only NbButton, named "Clear selection" from the string catalogue (selectClear), so a translated app names every select's clear button at once. Pass clear-label to name one select differently.

Searchable ​

Set searchable on a long list (countries, time zones, currencies) to show a search box at the top of the open list. It takes focus when the list opens, so the person types straight away, and each keystroke narrows the options. The match is anywhere in the label, ignoring case and accents: "sao" finds "São Tomé and Príncipe", and "cote" finds "Côte d'Ivoire".

vue
<template>
  <NbSelect
    v-model="country"
    label="Country"
    :options="countries"
    searchable
    search-placeholder="Search countries"
  />
</template>

The first match is highlighted as you type, so Enter picks it. ↑ and ↓ move through the matches without leaving the box, and Space types a space instead of choosing. Closing the list clears the search and returns focus to the select. When nothing matches, the list says "No results"; pass no-results-label to say it in your product's language.

Search is for lists long enough to need it. Under about ten options, a plain select is faster.

Your own trigger ​

Fill the trigger slot to open the same list from a control of your own: a chevron in a breadcrumb, an icon in a toolbar. The list, the search and the keyboard stay NbSelect's. Spread the slot's attrs on your button: it carries aria-expanded, aria-haspopup, aria-controls, aria-activedescendant and the click handler. Pass anchor (an element, or a function that returns one) to hang the list under a larger thing than the button, and selected-mark="check" to mark the chosen row with a check instead of filling it, as a menu of places to go does. NbBreadcrumbs uses all three for its switchers.

Creatable ​

Set :creatable="true" to show a text input at the bottom of the dropdown. When the user types a value and presses Enter, the create event fires with the entered string. You can then add it to your options array.

vue
<template>
  <NbSelect
    v-model="locale"
    label="Locale"
    :options="options"
    creatable
    create-placeholder="New locale..."
    @create="onCreate"
  />
</template>

<script setup lang="ts">
import { ref } from 'vue'

const locale = ref('en')
const options = ref([
  { label: 'English', value: 'en' },
  { label: 'Portuguese', value: 'pt' },
])

function onCreate(value: string) {
  options.value.push({ label: value, value: value.toLowerCase() })
}
</script>

Props ​

PropTypeDefaultDescription
modelValuestring | number | Array<string|number> | nullnullCurrent selection (v-model)
optionsISelectOption[][]Array of options
multiplebooleanfalseAllow multiple selections
creatablebooleanfalseShow a text input for creating new options
createPlaceholderstring'Add new...'Placeholder for the create input
clearablebooleanfalseShow a button that clears the selection
clearLabelstringcatalogueName and tooltip of the clear button
searchablebooleanfalseShow a search box at the top of the list
searchPlaceholderstring'Search'Placeholder and accessible name of the box
noResultsLabelstring'No results'Shown when nothing matches the search
selectedMark'fill' | 'check''fill'How the chosen option is marked in the list
anchorHTMLElement | (() => HTMLElement)-What the open list hangs under (with trigger)
variant'default' | 'fluid''default'Layout variant
labelstring-Label text
placeholderstring'Select…'Placeholder when nothing is selected
helperstring-Persistent helper text below the field
errorstring-Error message: triggers error state
warningstring-Warning message: triggers warning state
disabledbooleanfalseDisables the select
requiredbooleanfalseMarks the field as required (adds *)
idstringautoNative input id (auto-generated if omitted)
namestring-Native form name

Other attributes, such as a class, a style or a data- attribute, land on the field's root element, so <NbSelect class="w-40" /> sizes the field. The open list takes the field's width, so keep it wide enough for the options.

An icon per option ​

Give an option an icon when people recognise it by mark before they read the word: a platform, a provider, a file kind. It appears in the list and on the closed select, so the two cannot drift apart.

vue
<script setup lang="ts">
const options = [
  { label: 'LinkedIn', value: 'linkedin', icon: 'linkedin-logo' },
  { label: 'Instagram', value: 'instagram', icon: 'instagram-logo' },
  { label: 'X', value: 'x', icon: 'x-logo' },
  { label: 'Anywhere', value: 'generic' },
]
</script>

<template>
  <NbSelect v-model="platform" label="Platform" :options="options" />
</template>

Three things worth knowing:

  • An option without an icon is a plain row, not a gap where a mark should be, so a list can mix the two.
  • A multiple select shows no mark on the trigger. Its value is a count, and one mark beside "2 selected" would say less than the label alone.
  • The name is resolved at runtime. With the glyph catalogue off, register the names you pass (registerIcons), the same as anywhere else an icon name is computed rather than written in a template.

For a row this cannot express, an avatar and two lines of text for example, the option and value slots are still there.

Option interface ​

typescript
interface ISelectOption {
  label: string
  value: string | number
  disabled?: boolean
  /** Artwork before the label, in the list and on the closed select. */
  icon?: string
  /** The heading this option sits under. Runs are formed in order given. */
  group?: string
}

Events ​

EventPayloadDescription
update:modelValuestring | number | Array<string|number> | nullEmitted on every selection change
changesame as aboveAlso emitted on every change
createstringEmitted when the user submits a new value via the create input (requires creatable)

Exposed ​

typescript
const selectRef = ref<InstanceType<typeof NbSelect>>()
selectRef.value?.open() // programmatically open the dropdown
selectRef.value?.close() // programmatically close the dropdown

Keys, roles, validation announcements and what you own are on the Accessibility tab.