Select
The list unfolds from the field, one highlight glides between options and the chosen value rises in.
See it as an AI agent does.See this component the way an AI agent does.
Installation
npx shadcn@latest add @keyframery/selectThis adds components/keyframery/select.tsx and its primitive to your project, and installs UI SDK. The motion tokens are added to your global CSS the first time you install a component.
Usage
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/keyframery/select"
export default function Usage() {
return (
<Select defaultValue="light">
<SelectTrigger aria-label="Theme">
<SelectValue />
</SelectTrigger>
<SelectContent>
<SelectItem value="light">Light</SelectItem>
<SelectItem value="dark">Dark</SelectItem>
</SelectContent>
</Select>
)
}Anatomy
How the parts fit together:
Select
├── SelectTrigger
│ └── SelectValue
└── SelectContent
└── SelectItemExamples
Basic
With a label, a placeholder and a check on the chosen item.
Groups and details
Group items under labels. Pass items so the trigger shows each value's label, and anything else in a row stays in the list.
Several values
multiple keeps it open while you pick. The trigger lists the choices, and maxLabels shortens a long list to “and 2 more”.
Motion
| Move | What you see |
|---|---|
| Unfold | The list unfolds from the field. |
| Cascade | Options arrive one after another. |
| Glide | One highlight glides between options. |
| Direction | The chosen value rises into the field. |
Timing and springiness follow the motion style you set. To change how fast this select moves, pass speed:
<Select speed="fast">
…
</Select>"fast" is 0.6×, "slow" 1.4×, and a number sets the multiplier. With reduced motion turned on, nothing moves: changes happen at once or with a short fade.
Theming
Set these CSS variables on the component or a parent. Leave them unset to follow the light and dark theme. The open Customize panel below the preview lets you try these settings.
| Variable | What it changes | Default |
|---|---|---|
--select-face | Field and popup surfaces | --background; --popover on the popup |
--select-ink | Field and popup text | --foreground; --popover-foreground on the popup; --accent-foreground when highlighted |
--select-accent | Highlighted row | --accent |
--select-height | Field height | 2.25rem |
--select-radius | Field corners | 10px |
API reference
Every part takes className and children. Parts from UI SDK also take render, to draw your own element, and a function of their state for className and style. Props not listed here are in the UI SDK select reference.
Select
Prop
Type
SelectTrigger
Renders a <button>, and takes its props too.
Prop
Type
SelectValue
Renders a <span>, and takes its props too.
Prop
Type
SelectContent
Renders a <div>, and takes its props too.
Prop
Type
SelectItem
Renders a <div>, and takes its props too.
Prop
Type
SelectClear
Renders a <button>, and takes its props too.
Prop
Type
SelectItemIcon
Renders a <span>, and takes its props too.
Prop
Type
SelectItemIndicator
Renders a <span>, and takes its props too.
Prop
Type
SelectItems
Prop
Type
Other parts
These take the props of the element they render, and nothing else:
SelectArrow: a<div>SelectEmpty: a<div>SelectGroup: a<div>SelectGroupLabel: a<div>SelectInput: a<input>SelectItemText: a<span>SelectLabel: a<div>SelectList: a<div>SelectSelectAll: a<div>SelectSeparator: a<div>SelectStatus: a<div>SelectValueIcon: a<span>
Keyboard
| Key | What it does |
|---|---|
| Enter | Opens the list, or chooses the highlighted item. |
| ↓ ↑ | Moves between items. |
| A–Z | Jumps to an item starting with that letter. |
| Escape | Closes the list. |
Accessibility
Keyboard, focus and screen-reader behaviour come from UI SDK and are not changed. More in Accessibility.
Swap the import
Already using UI SDK's select with your own styles? Keep your markup and change one line. The primitive adds motion and nothing else.
// Before
import { … } from "@ui-sdk/react/select"
// After: same parts, same props, now animated
import { … } from "@/components/keyframery/primitives/select"Questions
How does the animated Select for UI SDK move?
Unfold: The list unfolds from the field. Cascade: Options arrive one after another. Glide: One highlight glides between options. Direction: The chosen value rises into the field.
Do I need Motion or Framer Motion for the animated Select?
No. Every move is plain CSS, so there is nothing to install besides the component and UI SDK.
Can I keep my own styling and only take the motion?
Yes. Import from @/components/keyframery/primitives/select instead. It has the same parts and props as @ui-sdk/react/select and adds motion only.
What happens to the Select when someone turns on reduced motion?
Nothing moves. State changes happen at once, or with a short fade.