Select

A dropdown whose panel pinches off the trigger and reveals its options.

Preview

"use client";

import { useState } from "react";
import {
  Select,
  SelectContent,
  SelectItem,
  SelectTrigger,
  SelectValue,
} from "@/components/motion/select";

export function SelectPreview() {
  const [value, setValue] = useState("next");
  return (
    <div className="w-56">
      <Select sound value={value} onValueChange={setValue}>
        <SelectTrigger>
          <SelectValue placeholder="Pick a framework" />
        </SelectTrigger>
        <SelectContent>
          <SelectItem value="next">Next.js</SelectItem>
          <SelectItem value="remix">Remix</SelectItem>
          <SelectItem value="astro">Astro</SelectItem>
          <SelectItem value="vite">Vite</SelectItem>
        </SelectContent>
      </Select>
    </div>
  );
}

Install

Add it with the shadcn CLI, or copy the source manually.

$ bunx --bun shadcn add @beui/select

API Reference

Select

value?
string

The selected value, for controlled use.

Default—
defaultValue?
string

The initial value when uncontrolled.

Default—
onValueChange?
((value: string) => void)

Called with the new value when an option is picked.

Default—
open?
boolean

Controlled open state of the panel. A layout that stacks selects can hold this to keep exactly one panel open — the panel is absolutely positioned inside its field, so two open at once paint over each other's options.

Default—
defaultOpen?
boolean

Uncontrolled initial open state. Default false.

Defaultfalse
onOpenChange?
((open: boolean) => void)

Fires whenever the panel opens or closes. The panel is absolutely positioned inside the field, so a layout that stacks selects has to know which one is open to paint it above its neighbours.

Default—
disabled?
boolean

Disables the trigger so the panel cannot open. Default: false

Defaultfalse
sound?
boolean

Play open and close swishes and a select on a pick. Off by default; a `SoundProvider` can mute it app-wide.

Defaultfalse
className?
string

Classes merged onto the root element.

Default—

SelectTrigger

className?
string

Classes merged onto the trigger button.

Default—

SelectValue

placeholder?
string

Text shown while nothing is selected. Default: "Select"

Default—
className?
string

Classes merged onto the label wrapper.

Default—

SelectContent

className?
string

Classes merged onto the options panel.

Default—

SelectItem

value
string

Value reported when this option is picked.

Default—
disabled?
boolean

Prevents picking this option. Default: false

Defaultfalse
className?
string

Classes merged onto the option button.

Default—
Also on React Native. A panel that unfolds out of its trigger.

More in Select

Updated