Skip to content

Select

Select

PSelect wraps a native <select> and renders options from an array.

Demo

Usage

<PSelect
v-model="status"
:items="items"
placeholder="Select status"
required
>
Status
</PSelect>
data() {
return {
status: '',
items: [
{ id: 'active', label: 'Active' },
{ id: 'paused', label: 'Paused', disabled: true },
],
};
}

Props

PropTypeDefaultNotes
idString''Optional ID for the <select>.
itemsArrayRequired items with { id, label } (optional fgColor, bgColor).
placeholderStringVälj ett alternativPlaceholder label.
valueString | Number''v-model value.
errorTextString''Override validation message.
showPlaceholderOptionBooleantrueShow the placeholder option.
requiredBooleanfalseMarks the input required.

Events

EventPayloadDescription
inputString | NumberEmits value changes.
changeString | NumberEmits change events.
validBooleanEmits HTML5 validity state.

Slots

SlotDescription
defaultInput label text.