Input
A single line field with clear labels and useful states.
An icon that morphs into a search field with results beneath it.
npx shadcn@latest add @silicon-ui/expanding-searchnpx shadcn@latest add @silicon-ui/expanding-searchInstall the dependencies.
npm install lucide-react motionCopy these files into your project. Shared files are skipped if you already have them.
components/silicon-ui/expanding-search/expanding-search.tsxcomponents/silicon-ui/expanding-search/expanding-search.module.cssInstall the foundation once per app for the design and motion tokens: npx shadcn@latest add @silicon-ui/silicon-foundation
| Prop | Type | Default |
|---|---|---|
label*Names the button, the field, and the results, such as "Search projects and docs". | string | — |
items* | ExpandingSearchItem[] | — |
suggestionsShown before anything is typed, such as recent searches. | ExpandingSearchItem[] | [] |
suggestionsLabel | string | "Recent" |
placeholder | string | — |
onSelect | (item: ExpandingSearchItem) => void | — |
onExpandedChange | (expanded: boolean) => void | — |
expandedWidthThe widest the field grows. It never grows past its container. | number | 360 |
maxResults | number | 6 |
anchorThe edge the button sits on; the field grows away from it. | "start" | "end" | "end" |
emptyHintA short tip under the empty state. | string | "Try a shorter word or check the spelling." |
className | string | — |