Skip to content

VPickNative

A styled wrapper around the native <select> element. Same browser behaviour, consistent design.

Usage

Vue 2.7

Same code works in Vue 2.7. Just change the import to import { VPickNative } from "vue-pick/vue2".

Options

The options prop accepts a flat array or a nested array with groups. Groups are detected automatically when an item has an options array.

Examples

Grouped

Disabled

Loading

Error

Sizes

Custom data shape

Use labelKey, valueKey, disabledKey, and groupOptionsKey to pass data straight from your API without mapping. See the Data Shape guide for the full reference.

Props

PropTypeDefaultDescription
modelValue / valueanyundefinedSelected value. Use v-model for two-way binding.
optionsOptionOrGroup[]requiredArray of options or option groups.
placeholderstringundefinedPlaceholder text shown when no value is selected.
disabledbooleanfalseDisables the select.
loadingbooleanfalseShows a spinner and disables interaction.
errorstringundefinedError message. Applies error styling and aria-invalid.
size"default" | "sm""default"Size variant.
idstringundefinedHTML id attribute.
namestringundefinedHTML name attribute for form submission.
requiredbooleanfalseHTML required attribute.
ariaLabelstringundefinedaria-label for accessibility.
ariaDescribedbystringundefinedaria-describedby for accessibility.
labelKeystring"label"Object key to read each option's visible label from.
valueKeystring"value"Object key to read each option's value from.
disabledKeystring"disabled"Object key to read each option's disabled flag from.
groupOptionsKeystring"options"Object key for the options array inside a group.

Slots

SlotDescription
iconCustom chevron icon. Shown when not loading.
loadingCustom loading indicator. Shown when loading is true.
vue
<VPickNative :options="options">
  <template #icon>
    <MyCustomChevron />
  </template>
  <template #loading>
    <MySpinner />
  </template>
</VPickNative>

Accessibility

  • Uses a real native <select> element for full browser and screen reader support.
  • aria-invalid is set when the error prop is present.
  • aria-busy is set when loading is true.
  • aria-describedby wired via the ariaDescribedby prop.
  • Disabled state uses native disabled attribute (not pointer-events).

Released under the MIT License.