ComponentsForm
Search Input
A search input with magnifying glass icon and optional clear button.
Default
Sizes
Disabled
Invalid
With Field
Installation
npx visor add search-inputThis copies two files into your project:
components/ui/search-input/search-input.tsx— the componentcomponents/ui/search-input/search-input.module.css— the styles
This also installs the input component as a dependency.
Usage
import { SearchInput } from '@/components/ui/search-input/search-input';
<SearchInput placeholder="Search..." />API Reference
SearchInputProps
| Prop | Type | Default | Description |
|---|---|---|---|
onClear | () => void | — | Callback when the clear button is clicked. |
placeholder | string | — | Placeholder text for the search field. |
disabled | boolean | false | Disables the search input. |
className | string | — | Additional CSS class names to merge onto the wrapper. |
...props | React.InputHTMLAttributes<HTMLInputElement> | — | All standard HTML input attributes are forwarded. |
The component also accepts all standard <input> HTML attributes.
Accessibility
- Renders
type="search"which adds browser-native clear functionality on some platforms - The search icon is
aria-hidden="true"— it is decorative - The clear button (when shown) has
aria-label="Clear search"and is only rendered when the input has a value - Provide a visible
<Label>oraria-labelto describe the search scope (e.g., "Search components", "Search users") - In a live-search context, pair with an
aria-live="polite"region to announce result counts as the user types