Keyframery

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.

Resize preview. Focus the handle and use the left or right arrow keys. Hold Shift for larger steps.— px
Customize1 controls
Animation speed1×

Installation

npx shadcn@latest add @keyframery/select

This 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
    └── SelectItem

Examples

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

MoveWhat you see
UnfoldThe list unfolds from the field.
CascadeOptions arrive one after another.
GlideOne highlight glides between options.
DirectionThe 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.

VariableWhat it changesDefault
--select-faceField and popup surfaces--background; --popover on the popup
--select-inkField and popup text--foreground; --popover-foreground on the popup; --accent-foreground when highlighted
--select-accentHighlighted row--accent
--select-heightField height2.25rem
--select-radiusField corners10px

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

KeyWhat it does
EnterOpens the list, or chooses the highlighted item.
↓ ↑Moves between items.
A–ZJumps to an item starting with that letter.
EscapeCloses 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.

All components

On this page