# SearchField

Search with a clear action that belongs to the input.

- Family: Forms, imported from `mizu-ui` or `mizu-ui/forms`
- Docs: https://mizu.user64bit.world/components/search-field
- Source: https://github.com/0xuser64bit/mizu/blob/main/packages/mizu/src/forms/Fields.tsx

## Usage

```tsx
"use client";

import { useState } from "react";
import { SearchField } from "mizu-ui";

export function Example() {
  const [query, setQuery] = useState("");
  return (
    <SearchField
      value={query}
      onValueChange={setQuery}
      label="Find a component"
    />
  );
}
```

## Copy it with the shadcn CLI

```sh
npx shadcn@latest init 0xuser64bit/mizu/preset # once, where there is no components.json
npx shadcn@latest add 0xuser64bit/mizu/search-field
```

## Props

- `value`: `string`. Controlled query.
- `onValueChange`: `(value: string) => void`. Typing and clear events.
- `label`: `string` (default `"Search"`). Input label.

## Accessibility

Uses input type=search and a separately named clear button. Does not impose a search algorithm.

## Motion

CSS transitions explain state changes. Reduced motion removes travel.
