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">
import Select from '@/components/ui/select/Select.vue'

const value = ref('alixan')
const options = [
  { label: 'Alixan UI', value: 'alixan' },
  { label: 'Cupertino', value: 'cupertino' },
  { label: 'Material', value: 'material', disabled: true },
]
</script>

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

Validation

<script setup lang="ts">
import Select from '@/components/ui/select/Select.vue'

const value = ref(null)
const options = [
  { label: 'Alixan UI', value: 'alixan' },
  { label: 'Cupertino', value: 'cupertino' },
  { label: 'Material', value: 'material', 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.