Search Field

Collects a search query, with room for a keyboard shortcut hint.

Configurations

Supported configurations for this component.

Default

Interaction states covered by the API and the style contract.

Configurations

4 examples
Default
sm
md
lg
Custom shortcut
sm
md
lg
No shortcut
sm
md
lg
With value
sm
md
lg

Default

1 example

Add to your project

One command adds this component to your project.

1

Run the following command. New project? Run npx shadcn@latest init first to set up Tailwind and path aliases.

npx shadcn@latest add @aicanvas/••••••••••••

Light and dark both come with the install and follow the dark class on <html>, the shadcn dark mode setup (next-themes with attribute="class").

Props

Every prop this component accepts. Any other prop is forwarded to the underlying element.

PropTypeDefaultDescription
size'sm'|'md'|'lg''md'Rung on the shared control ladder: 28, 32 or 40px tall. Matches Button, IconButton and Input at the same value.
placeholderstring'Search anything'Text shown when empty. Defaults to "Search anything".
shortcutstring|null'⌘ K'Keyboard shortcut chip. Pass null to hide. Defaults to "⌘ K".
iconReact.ComponentType<{ size?: number, weight?: string, color?: string, style?: React.CSSProperties }>MagnifyingGlassPhosphor-style leading icon. Defaults to MagnifyingGlass. Pass null to hide.
valuestring-Controlled value.
defaultValuestring-Uncontrolled initial value.
onValueChange(next: string) => void-Called when typed value changes.
ariaLabelstring-Accessible label for the input. Defaults to placeholder.
classNamestring-Class name forwarded to the outer wrapper.
styleReact.CSSProperties-Style merged into the outer wrapper (lets the parent set width).
disabledboolean-Disables the field: dims it to the disabled opacity, shows a not-allowed cursor, and disables the underlying input.

More Andromeda Pro components