VPickNative API
Every prop, slot and event in one place.
Props
modelValueany default undefinedSelected value. Use v-model for two-way binding. In Vue 2 the prop is value.
placeholderstring default undefinedText shown when no value is selected.
disabledboolean default falseDisables the control.
loadingboolean default falseShows a spinner and disables interaction.
errorstring default undefinedError message. Applies error styling and aria-invalid.
idstring default undefinedHTML id, applied to the control itself so a <label for> resolves to it.
requiredboolean default falseHTML required attribute.
ariaLabelstring default undefinedaria-label, for when there is no visible label.
ariaDescribedbystring default undefinedaria-describedby, for wiring up hint or error text.
labelKeystring | string[] default "label"Key to read each option's visible label from. An array acts as a fallback chain: the first key with a non-empty value wins.
Slots
| Slot | Description |
|---|---|
icon | Custom chevron icon. Shown when not loading. |
loading | Custom loading indicator. Shown when loading is true. |
<VPickNative :options="options">
<template #icon>
<MyCustomChevron />
</template>
<template #loading>
<MySpinner />
</template>
</VPickNative>The two are mutually exclusive: whichever suits the current state is the one rendered.
Events
| Event | Payload | Description |
|---|---|---|
update:modelValue | any | Emitted when the selection changes. Vue 2 emits input instead, which is what v-model listens for there. |
One event, because the browser owns the interaction. VPick additionally emits search, select and deselect, none of which have a meaning here.
CSS custom properties
Theming is documented separately, since most variables are shared with VPick. See Theming.
Types
interface OptionItem {
label: string
value: any
disabled?: boolean
// Set by Vue Pick, not by you: the original object you passed in.
raw?: unknown
}
interface OptionGroup {
label: string
disabled?: boolean
options: OptionItem[]
}
type OptionOrGroup = OptionItem | OptionGroupchildren is absent here on purpose: a native <select> cannot nest beyond one level of <optgroup>, so tree data is VPick's.
See the Data Shape guide for reading your own shapes without transforming them.