# Search Field

> Search input with a clear action.

Registry name: `search-field`. HTML docs: https://ui.anuragroy.dev/component/search-field.

## Install

```bash
npx shadcn@latest add https://ui.anuragroy.dev/r/search-field.json
```

If the website is down: `npx shadcn@latest add https://raw.githubusercontent.com/anurag-roy/ui.anuragroy.dev/main/public/r/search-field.json`.

Registry JSON: https://ui.anuragroy.dev/r/search-field.json (GitHub: https://raw.githubusercontent.com/anurag-roy/ui.anuragroy.dev/main/public/r/search-field.json).

## Import

Import paths follow the consumer `components.json` aliases. After a default install:

```tsx
import { SearchField } from "@/components/ui/search-field"
```

## Usage

```tsx
import { SearchField } from "@/components/ui/search-field"

export function Example() {
  return <SearchField placeholder="Search…" />
}
```

## API

### SearchField

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `value` | string | — | Controlled value. |
| `defaultValue` | string | — |  |
| `onValueChange` | (value: string) => void | — |  |
| `onClear` | () => void | — |  |
| `clearLabel` | string | "Clear search" |  |

## See also

- [HTML page](https://ui.anuragroy.dev/component/search-field): Preview and the same docs in the site chrome.
- [Registry item](https://ui.anuragroy.dev/r/search-field.json): Source files and dependencies.
- [Catalog](https://ui.anuragroy.dev/component): All components.
- [llms.txt](https://ui.anuragroy.dev/llms.txt): Agent index for this library.
