Select

Select produces a prettier HTML select. It supports arrays of strings, numbers, or objects, and offers customization for value, label, color, size, and more. Easily integrates with forms and supports disabled states, custom option rendering, and grouped styles.

Basic Usage

Code Example
Basic.vue

Components

The Select components include the following:

  • Select - A customizable and styled HTML select input.
  • ValidatorHint - A component for displaying validation messages or hints.

Select

The Select component provides a styled dropdown input supporting arrays of strings, numbers, or objects, with flexible value and label customization, color and size variants, and disabled and ghost states.

Select Props Type Description
modelValue
any
v-model The currently selected value.
options
Array

An array of strings, numbers, or objects to display as options.

value
function

Function to extract the value from each option object.

label
function

Function to extract the label from each option object.

resultAsObject
boolean

Emits the entire object instead of just the value.

join
boolean

Use inside Join to group items together.

ghost
boolean

Makes the select transparent until focused.

disabled
boolean

Disables the select input.

color
string

Sets the color theme. Options: neutral, primary, secondary, accent, info, success, warning, error.

   
primary
boolean

Sets color to primary

   
secondary
boolean

Sets color to secondary

   
accent
boolean

Sets color to accent

   
info
boolean

Sets color to info

   
success
boolean

Sets color to success

   
warning
boolean

Sets color to warning

   
error
boolean

Sets color to error

size
'xl' | 'lg' | 'md' | 'sm' | 'xs'

Sets the select size. Options: xl, lg, md, sm, xs.

   
xl
boolean

Sets size to xl

   
lg
boolean

Sets size to lg

   
md
boolean

Sets size to md

   
sm
boolean

Sets size to sm

   
xs
boolean

Sets size to xs

validator
boolean

Adds the validator class for select validation styling.

Select Events Arguments Description
update:modelValue
v-model Emitted when the user selects a new value.

ValidatorHint

The ValidatorHint component provides a styled container for validation messages or hints, often used in conjunction with form validation.

ValidatorHint Slots Description
default

Displays the validation message or hint text.

Examples

Color

Select components with different color variants.

Code Example
Color.vue

Custom Options

Using custom value and label extraction functions.

A
Code Example
CustomOptions.vue

Disabled

A disabled select component.

Code Example
Disabled.vue

Ghost

A select with ghost (transparent) style.

Code Example
Ghost.vue

Null and Disabled Values

Handling null and disabled option values.

{
  "value": null,
  "label": "No Song Selected"
}
Code Example
NullAndDisabledValues.vue

Options as Object

Options as objects with custom value and label.

A
Code Example
OptionsAsObject.vue

Result as Object

Emitting the entire object as the value.

{
  "value": "1",
  "label": "Homer"
}
Code Example
ResultAsObject.vue

Size

Different select sizes.

Code Example
Size.vue