Select
A portaled select with a staggered blur-fade reveal, directional slides, and keyboard typeahead.
value="spring-pop"·direction="auto"
Customize
Installation
Add the component with the registry command:
npx shadcn@latest add @kinetic/selectUsage
Select supports both a data-driven options array and declarative compound subcomponents (SelectTrigger, SelectValue, SelectContent, SelectGroup, SelectLabel, SelectItem, SelectSeparator). Pass options for quick lists:
import { Select } from "@/components/kinetic/ui/select";
const options = [
{ value: "apple", label: "Apple" },
{ value: "pear", label: "Pear" },
];
export function FruitSelect() {
return <Select options={options} placeholder="Pick one" aria-label="Fruit" />;
}Options, groups and separators
options accepts option items (value, label, and optional icon, disabled, textValue), group headings (group), and separators (separator: true).
<Select
options={[
{ group: "Fruit" },
{ value: "apple", label: "Apple" },
{ value: "pear", label: "Pear", disabled: true },
{ separator: true },
{ value: "plum", label: "Plum" },
]}
placeholder="Pick one"
/>Controlled state
Pass value with onValueChange, or use defaultValue for uncontrolled usage.
const [fruit, setFruit] = useState("apple");
<Select options={options} value={fruit} onValueChange={setFruit} />Reveal direction
Set direction to auto (default), zig, top, bottom, left, right, or scale. With auto, options animate downward when the list opens below the trigger and upward when flipped above it. Tune the reveal with blurPx, staggerMs, durationMs, and distancePx. Use size with sm, default, or md.
<Select options={options} direction="zig" blurPx={12} staggerMs={36} size="sm" />Compound API
Omit options and compose SelectTrigger, SelectValue, SelectContent, SelectGroup, SelectLabel, SelectItem, and SelectSeparator inside Select for custom trigger layouts, labels, or item content. SelectValue resolves initial defaultValue labels before opening, SelectContent supports position="popper" (anchored below or above the trigger) as well as "item-aligned", and setting invalid on Select or SelectTrigger triggers a validation shake.
import {
Select,
SelectContent,
SelectGroup,
SelectItem,
SelectLabel,
SelectSeparator,
SelectTrigger,
SelectValue,
} from "@/components/kinetic/ui/select";
interface RoleSelectProps {
defaultValue?: string;
}
export function RoleSelect({ defaultValue = "editor" }: RoleSelectProps) {
return (
<Select defaultValue={defaultValue}>
<SelectTrigger aria-label="Role">
<SelectValue placeholder="Choose a role" />
</SelectTrigger>
<SelectContent position="popper">
<SelectGroup>
<SelectLabel>Workspace</SelectLabel>
<SelectItem value="admin">Admin</SelectItem>
<SelectItem value="editor">Editor</SelectItem>
</SelectGroup>
<SelectSeparator />
<SelectGroup>
<SelectLabel>External</SelectLabel>
<SelectItem value="guest">Guest</SelectItem>
</SelectGroup>
</SelectContent>
</Select>
);
}Keyboard
On the trigger, ArrowDown, ArrowUp, Enter, and Space open the list. Inside the list, ArrowUp and ArrowDown move the highlight, Home and End jump to the first and last enabled option, Enter or Space picks the option, and typing characters jumps to the first enabled option whose text starts with them (the buffer resets after 500 ms). Escape closes the list and returns focus to the trigger; Tab closes it. The menu opens with the selected option (or the first enabled one) aligned over the trigger and is kept inside the viewport.
Motion preferences
Blur, slide, and stagger effects are removed when reduced motion is enabled, either in the browser or in the Kinetic setting. Timing is scaled by the speed prop.
API Reference
Select
Portaled select supporting both options arrays (staggered blur-fade list) and compound composition (floating menu with spring hover strip and full ARIA listbox keyboard nav).
| Prop | Type | Default | Description |
|---|---|---|---|
options | readonly SelectEntry[] | - | Array mode: option items ({ value, label, icon?, disabled? }), group headers ({ group }), and separators ({ separator: true }). Omit when using compound children. |
value / defaultValue / onValueChange | string / string / (value: string) => void | - | Controlled or initial selected value and selection callback. |
open / defaultOpen / onOpenChange | boolean / boolean / (open: boolean) => void | - | Controlled or uncontrolled menu visibility state in compound mode. |
direction / blurPx / staggerMs / durationMs / distancePx | BlurSelectDirection / number | "auto" / 8 / 28 / 260 / 10 | Staggered reveal trajectory, blur radius, item delay, reveal duration, and slide offset. |
size / speed / disabled / invalid / name / required | "sm" | "md" / number / boolean / string | "md" / 1 / false | Trigger height (array mode), animation speed multiplier, disabled/invalid state, and form input name. |
SelectTrigger / SelectValue
Compound trigger button with rotating chevron and invalid shake, plus value display resolving defaultValue labels before opening.
| Prop | Type | Default | Description |
|---|---|---|---|
size (SelectTrigger) | "sm" | "default" | "md" | "default" | Adjusts trigger height between compact (sm) and standard (default/md). |
invalid (SelectTrigger) | boolean | false | Applies destructive border styling and plays invalid shake. |
placeholder / children (SelectValue) | React.ReactNode | ((option: SelectRegisteredOption | undefined) => React.ReactNode) | "Select..." | Fallback label when unselected or custom render function receiving the active option. |
SelectContent
Portaled floating listbox using viewport collision flipping and spring sliding hover highlight.
| Prop | Type | Default | Description |
|---|---|---|---|
position | "popper" | "item-aligned" | "popper" | Positions relative to trigger below/above (popper) or aligns selected option over trigger. |
side / align / sideOffset / alignOffset / collisionPadding | "top" | "bottom" / "start" | "center" | "end" / number | "bottom" / "start" / 6 / 0 / 8 | Floating placement, alignment, pixel offsets, and viewport edge padding. |
matchTriggerWidth / direction / blurPx / speed / container | boolean / BlurSelectDirection / number / number / Element | null | true / "auto" / inherited / inherited / document.body | Locks popup min-width to trigger width, sets item reveal direction, overrides blur/speed, and sets portal container. |
SelectGroup / SelectLabel / SelectItem / SelectSeparator
Semantic fieldset group with auto aria-labelledby, section label, stroke-draw option row, and divider.
| Prop | Type | Default | Description |
|---|---|---|---|
value / disabled / textValue (SelectItem) | string / boolean / string | - | Option value, disabled toggle, and optional text label used for display and keyboard typeahead. |