On this page

Select

Install, props and the parts Select is built from.

Install

Run this in the app, after shadcn-vue init and the Beehexa theme (Button › Code):

npx shadcn-vue@latest add https://beehexa.design/r/select.json

Use

<script setup lang="ts">
import { ref } from 'vue'
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'

const status = ref<string>()
</script>

<template>
  <label for="order-status">Order status</label>
  <Select v-model="status">
    <SelectTrigger id="order-status">
      <SelectValue placeholder="Choose a status" />
    </SelectTrigger>
    <SelectContent>
      <SelectItem value="pending">Pending</SelectItem>
      <SelectItem value="shipped">Shipped</SelectItem>
    </SelectContent>
  </Select>
</template>

Props

Part Prop Values Notes
Select v-model, defaultValue string, or an object with by Never the empty string: it clears the select
Select multiple boolean Lets people choose several; prefer checkboxes or a combobox
Select disabled, required, name name sends the value with a native form
SelectTrigger size default (32 px), sm (24 px)
SelectTrigger aria-invalid boolean Red edge; pair it with an error message and aria-describedby
SelectValue placeholder string Shown while nothing is chosen
SelectContent position popper (default), item-aligned popper opens below the field
SelectItem value, disabled, textValue
SelectGroup, SelectLabel, SelectSeparator Group headings and lines in the list

Built on

Wraps the reka-ui Select with the shadcn-vue Select API, from the control-center copy. reka-ui gives the combobox and listbox roles, keyboard handling, typeahead, collision handling and the hidden native select for forms. Beehexa adds the field and list styles.

Limitations

  • The list appears and leaves with the shadcn-vue animation classes, not the motion tokens (motion.overlay.enter, .exit), for now.
  • reka-ui adds a <style> element to the list, which the strict style level of the Content Security Policy blocks. The list still hides its scrollbar with the kit’s CSS; to stop the browser’s error at that level, add the Vite plugin from Tools › shadcn-vue package.