Haedong
021

Select

Form

No value

Customize

State
Field

Code

<Field label="Mood">
  <Select
    options={MOODS}
    placeholder="Pick a mood"
    value={mood}
    onValueChange={setMood}
  />
</Field>

Install

npx shadcn@latest add https://components.haedong.dev/r/select.json

Props

Data-driven: pass options, not children. Extends the native div props of the root; label it with aria-label / aria-labelledby, or wrap it in Field.

PropTypeDescription
options{ value: string; label: string; disabled?: boolean }[]The choices. Disabled options are shown dimmed and skipped by the keyboard.
value / defaultValuestringSelected value (controlled / uncontrolled).
onValueChange(value: string) => voidCalled on click, Enter or Space on an option; the list then closes.
placeholderstringMuted uppercase when nothing is selected. Defaults to "Select".
namestringRenders a hidden input so the value submits with a form.
disabledbooleanDims the trigger to 40% and drops pointer events.
aria-invalidbooleanDashed full-strength hairline on the trigger, like Input.