For the complete documentation index, see llms.txt. Markdown variants are available by appending .md to any URL or sending an Accept: text/markdown header. An agent skill is available at /.well-known/agent-skills/site-skill.md.
/
144
Sponsor

Select

A select with trigger, panel, and item animations.

Select a fruit
Apple
Banana
Orange
Grape
Customize

Installation

$ pnpm dlx shadcn@latest add @framecn/select

Usage

import { Select } from "@/components/ui/select";
<Select label="Select a fruit" state="opened" />

Smooth transitions

The docs preview animates an outline trigger press, opens the panel, selects row 1 (Banana) via hover → press → selected, then closes. Drive the trigger with useButtonTransition, the panel with useSelectTransition, and row states with useSelectItemTransition:

import { useButtonTransition } from "@/components/framecn/use-button-transition";
import { Select } from "@/components/framecn/select";
import { useSelectTransition } from "@/components/framecn/use-select-transition";
import { useSelectItemTransition } from "@/components/framecn/use-select-item-transition";
 
const triggerStyle = useButtonTransition(
  [
    { at: 14, state: "hover" },
    { at: 26, state: "press" },
  ],
  { variant: "outline" }
);
 
const panel = useSelectTransition([
  { at: 32, state: "opened", duration: 16 },
  { at: 96, state: "closed", duration: 12 },
]);
 
const row = useSelectItemTransition([
  { at: 52, state: "hover" },
  { at: 64, state: "press" },
  { at: 72, state: "selected", duration: 10 },
]);
 
<Select
  label="Select a fruit"
  style={panel}
  triggerStyle={triggerStyle}
  itemStyles={[undefined, row, undefined, undefined]}
/>;

style takes precedence over state when both are provided. itemStyles is indexed by row.

API Reference

Select

PropTypeDefault
state"opened" | "closed""closed"
styleSelectStyle- (takes precedence over state)
labelstring"Select a fruit"
triggerStyleButtonStyle-
itemsstring[]["Apple", "Banana", "Orange", "Grape"]
selectedIndexnumber-1
highlightedIndexnumber-1
pressedIndexnumber-1
itemStyles(SelectItemStyle | undefined)[]- (per-row override, indexed by row)
themePartial<FramecnTheme>-
classNamestring-