Select

A floating label select with a teleported menu and click-catcher overlay.

Installation

npx alixan-ui-nuxt add select

Usage

<script setup lang="ts">
const value = ref('cupertino')
const options = [
  { label: 'Cupertino', value: 'cupertino' },
  { label: 'Material', value: 'material' },
  { label: 'Fluent', value: 'fluent', disabled: true },
]
</script>

<template>
  <Select v-model="value" label="Design" :options="options" />
</template>

Validation

<script setup lang="ts">
const value = ref(null)
const options = [
  { label: 'Cupertino', value: 'cupertino' },
  { label: 'Material', value: 'material' },
  { label: 'Fluent', value: 'fluent', disabled: true },
]
</script>

<template>
  <Select v-model="value" label="Design" :options="options" required />
</template>

API Reference

PropTypeDefaultDescription
modelValuestring | number | nullnullSelected option value used by v-model.
labelstring-Floating label text.
placeholderstring'Select option'Text shown when no option is selected.
optionsSelectOption[][]Options list with label, value and optional disabled.
disabledbooleanfalseDisables select interaction.
teleportbooleantrueTeleports menu to body. Keep true for nested popovers; set false only when the menu must stay inside the local layout.
requiredbooleanfalseShows the required validation message when no option is selected.
errorstring''External validation message shown after the select is touched.