Search field
A recognizable search entry point with clear affordances.
npx shadcn@latest add @silicon-ui/search-fieldInstallation
With the shadcn CLI
npx shadcn@latest add @silicon-ui/search-fieldManually
Install the dependencies
npm install lucide-react motionCopy these files into your project
- components/silicon-ui/search-field/search-field.tsx
- components/silicon-ui/search-field/search-field.module.css
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*The field's name. Always given; with `hideLabel` it is read by screen readers but not shown. | string | — |
value* | string | — |
onValueChange* | (value: string) => void | — |
hideLabelExperimental. Keeps the label for assistive technology but doesn't show it, for a search field whose place says what it searches (a sidebar's head, a toolbar). The resting border is `--search-field-border` (default --border-strong). | boolean | false |
Also accepts the props of InputHTMLAttributes<HTMLInputElement>, except type.
Dependencies
- npm
- lucide-reactmotion
- Registry
- silicon-motion-tokens