VisorVisor
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-input

This copies two files into your project:

  • components/ui/search-input/search-input.tsx — the component
  • components/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

PropTypeDefaultDescription
onClear() => voidCallback when the clear button is clicked.
placeholderstringPlaceholder text for the search field.
disabledbooleanfalseDisables the search input.
classNamestringAdditional CSS class names to merge onto the wrapper.
...propsReact.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> or aria-label to 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