---
agent:
  instructions: "Search goop.so for Goop's components, templates, design skill, docs, pricing and terms. Ask in keywords or a plain question, such as \"date picker props\" or \"is the design skill free\"; the answer is the matching page sections in Markdown, each with its address."
  endpoint: "https://goop.so/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

# Search input

A search field with the search icon at its start, for narrowing a list or a page, for React and Tailwind CSS. Free, MIT.

Free. Its export: `SearchInput`.

## Try it

Type to search nine help articles: the list says it is searching for a moment, then shows the articles holding every word you typed. Try “study”, “consent” or a word none holds; Escape empties the field (where the field has a clear button, it does too, and the line says it was cleared). Switch the field’s size.

The search is a timer over nine titles of our own. The field shows no clear button (the browser’s is hidden by the theme); Escape, the browser’s own, empties it.

## When to use

- A search field with the search icon at its start, for narrowing a list or a page.
- Also called: search box or search bar.

## When not to use

- For a palette of commands use CommandPalette.

## Installation

Paste the prompt below into your coding agent. It reads Goop's install steps, installs the part and its tokens once, then reuses this same Search input on every screen instead of drawing a new one: the same height, the same focus ring, the same spacing.

```sh
npx shadcn@4.23.1 add @goop/trail-search-input
```

```text
Add the Goop Search input to this project. The install steps are at https://goop.so/docs/install.md
```

## Usage

```tsx
import { SearchInput } from '@/components/ui/goop/search-input';

<SearchInput label="Search notes" placeholder="Search" />
```

- Fits: board, inbox, list, states, frame (their recipes); frame: sidebar-search.
- width, corner, border: add no class for these.

## API reference

### Options

- `label: ReactNode` — The field's name, read by a screen reader and never shown (required).
- `size?: 'sm' | 'md' | 'lg'` — The bar: `md` (the default) 32 px for a list, `sm` a 28 px raised bar for a sidebar, `lg` a 44 px framed bar.
- `value?: string`
- `defaultValue?: string`
- `onChange?: (event: ChangeEvent<HTMLInputElement>) => void`
- `name?: string`
- `required?: boolean`
- `disabled?: boolean`
- `form?: string`

- Takes every prop of TextInput but variant (its page: text-input.md)

## Accessibility

- hover, active, focus-visible, focus-within: the browser's own (:hover, :active, :focus-visible, :focus-within): write nothing
- disabled: the prop disabled

## Notes for AI

Give your coding agent this page as text instead of screenshots: the parts, the options, the states and the keys. An agent that reads the real part builds the real part, not a lookalike.

## Related

- [Command palette](/themes/trail/components/command-palette): A layer of commands under a search field, opened over the app by a key chord such as Cmd K, to run an action by typing its name.
- [Password field](/themes/trail/components/password-field): A field for a password with a button that shows or hides the typed words, for sign-in, sign-up and reset forms.
- [Number input](/themes/trail/components/number-input): A field for a number, an amount or a quantity, typed in the reader's language or stepped with the arrow keys.
- [Input group](/themes/trail/components/input-group): A text field with add-ons inside its frame, for a web address, a unit, a search with its key or a copy field.
