Components

Select

An animated React select built on shadcn/ui and Radix Select: the drop-in Select grows out of its trigger, flips its chevron and fades in the check mark — plus a Motion block with a list that scales open, cascading options and a highlight that glides between items.

  • Drop-in shadcn API
  • Radix Select
  • Motion layoutId
  • Keyboard & typeahead
  • prefers-reduced-motion

Deploying to fra1

Installation

$ npx shadcn@latest add https://duskui.com/r/select.json

Replaces components/ui/select.tsx with the same parts and data-slot attributes, so existing selects keep working. The base Select animates with CSS only (tw-animate-css).

Usage

theme-select.tsx
import {
  Select,
  SelectContent,
  SelectItem,
  SelectTrigger,
  SelectValue,
} from "@/components/ui/select"

export function ThemeSelect() {
  return (
    <Select defaultValue="system" name="theme">
      <SelectTrigger className="w-44" aria-label="Theme">
        <SelectValue placeholder="Theme" />
      </SelectTrigger>
      <SelectContent>
        <SelectItem value="light">Light</SelectItem>
        <SelectItem value="dark">Dark</SelectItem>
        <SelectItem value="system">System</SelectItem>
      </SelectContent>
    </Select>
  )
}

Examples

Default

A labelled select with a group heading and a disabled option. In the default item-aligned mode the selected option lines up with the trigger, like a native select.

Groups & scrolling

position="popper" drops the list below the trigger at its width and slides it in from the side it opens on. Long lists scroll, with scroll buttons at the edges, and name submits the value with a form.

Sizes & states

size="sm" on the trigger for dense UIs, aria-invalid for errors (link the message with aria-describedby) and disabled.

Pick a role to continue.

Blocks

Ready-made variations composed from the base component with Motion. Each installs on its own and pulls in its dependencies automatically.

Animated Select

The list scales out of the trigger and options cascade in quickly. A highlight pill glides between options as you hover or arrow through them (a shared Motion layoutId), the selected option's check mark fades in, and the active option's icon brightens. Options can carry an icon (shown in the trigger too) and a description. Same composition as the shadcn Select.

Deploying to fra1

$ npx shadcn@latest add https://duskui.com/r/animated-select.json
PropTypeDefaultDescription
value / onValueChangestring / (value: string) => void—Controlled selection (on AnimatedSelect).
defaultValuestring—Uncontrolled initial selection.
open / onOpenChangeboolean / (open: boolean) => void—Controlled open state.
name / required / disabledRadix Select props—Forwarded to the Radix root; `name` submits with forms.
AnimatedSelectTriggerSelectTrigger props—The trigger button. Put AnimatedSelectValue inside.
AnimatedSelectContent › staggernumber0.015Delay between options as they cascade in, in seconds.
AnimatedSelectContent › side / align / sideOffsetRadix props"bottom" / "start" / 6Placement next to the trigger.
AnimatedSelectItem › iconReactNode—Leading icon; also shown in the trigger when selected.
AnimatedSelectItem › descriptionReactNode—Secondary text on the right (list only).
AnimatedSelectGroup / Label / Separator——Group options under a heading; the separator draws in.

API Reference

Same parts as shadcn/ui — Select, SelectGroup, SelectValue, SelectTrigger, SelectContent, SelectLabel, SelectItem, SelectSeparator, SelectScrollUpButton and SelectScrollDownButton — each forwarding its Radix Select props.

PropTypeDefaultDescription
value / onValueChangestring / (value: string) => void—Controlled selection (on Select).
defaultValuestring—Uncontrolled initial selection.
name / required / disabledstring / boolean / boolean—Form integration on Select. A hidden native select submits the value.
size"sm" | "default""default"On SelectTrigger: 32px or 36px tall.
position"item-aligned" | "popper""item-aligned"On SelectContent: align the selected item over the trigger, or drop below it.
placeholderReactNode—On SelectValue: shown until something is selected.
disabledboolean—On SelectItem: skip it in keyboard navigation and typeahead.

Accessibility

  • Built on Radix Select: the trigger is a combobox button, the list a listbox of options with aria-selected; arrow keys, Home, End, Enter, Space, Escape and typeahead all work.
  • Label the trigger with a <label htmlFor> pointing at its id, or aria-label. Mark errors with aria-invalid and link the message with aria-describedby.
  • A hidden native select mirrors the value, so forms, autofill and form reset work.
  • The gliding highlight is decorative (aria-hidden); the active option is still conveyed by focus and data-highlighted.
  • Under prefers-reduced-motion the list only fades, options appear without movement and the highlight jumps.