Morph select
A select whose trigger grows into the list, with a gliding highlight and type-ahead.
npx shadcn@latest add @silicon-ui/morph-selectInstallation
With the shadcn CLI
npx shadcn@latest add @silicon-ui/morph-selectManually
Install the dependencies
npm install lucide-react motionCopy these files into your project
- components/silicon-ui/morph-select/morph-select.tsx
- components/silicon-ui/morph-select/morph-select.module.css
Shared with other components. Skip any you already have.
- components/silicon-ui/lib/fluid-hover.tsx
Add the foundation, once per app, for the design and motion tokens
npx shadcn@latest add @silicon-ui/silicon-foundation
Usage
API reference
| Prop | Type | Default |
|---|---|---|
label*Visible label, also the accessible name of the trigger and the list. | string | — |
items* | MorphSelectItem[] | — |
hideLabelKeeps the label for assistive technology only. | boolean | false |
value | string | null | — |
defaultValue | string | null | null |
onValueChange | (value: string, option: MorphSelectOption) => void | — |
placeholder | string | "Select" |
searchableShows a search field in place of the trigger when open. "auto" turns it on above eight options. | boolean | "auto" | "auto" |
searchPlaceholder | string | — |
panelWidthWidth of the open surface in px. It never gets narrower than the trigger. Defaults to 272. | number | 272 |
maxListHeightTallest the option list gets before it scrolls, in px. Defaults to 296. | number | 296 |
alignWhich edge of the trigger stays put while the surface grows. | "start" | "end" | "start" |
nameAdds a hidden input for native form submission. | string | — |
disabled | boolean | false |
className | string | — |
Dependencies
- npm
- lucide-reactmotion
- Registry
- silicon-motion-tokens