Skip to content

Search field

A recognizable search entry point with clear affordances.

FieldSearch
npx shadcn@latest add @silicon-ui/search-field

Installation

With the shadcn CLI

npx shadcn@latest add @silicon-ui/search-field

Manually

  1. Install the dependencies

    npm install lucide-react motion
  2. Copy these files into your project

    • components/silicon-ui/search-field/search-field.tsx
    • components/silicon-ui/search-field/search-field.module.css
  3. Add the foundation, once per app, for the design and motion tokens

    npx shadcn@latest add @silicon-ui/silicon-foundation

Usage

usage.tsx
import { SearchField } from "@/components/silicon-ui/search-field/search-field";

API reference

PropTypeDefault
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—
hideLabel

Experimental. 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).

booleanfalse

Also accepts the props of InputHTMLAttributes<HTMLInputElement>, except type.

Dependencies

npm
lucide-reactmotion
Registry
silicon-motion-tokens