# SearchTrigger

A button for opening search, with a compact icon-only option and an optional keyboard hint.

Connect Flood once using [the installation guide](https://flood.md/docs/installation). Then import the components you use; no per-component add command is needed.

## Example

```tsx
"use client";

import { FloodRoot, CommandPalette, SearchTrigger } from "@flood-md/react";
import "@flood-md/react/styles.css";

export function Example() {
  return (
    <FloodRoot>
      <CommandPalette title="Find a page" searchLabel="Search pages" items={[{id:"projects",label:"Projects"}]} onAction={id => {}} trigger={props => <SearchTrigger {...props} label="Find a page" />} />
    </FloodRoot>
  );
}
```

## Design notes

- Use SearchTrigger to open search in another surface. Use SearchInput when people can enter a query in place.
- Use iconOnly in a compact toolbar and fullWidth in a wider sidebar. Keep the label meaningful in either layout.
- Supply shortcut and aria-keyshortcuts only when the host has implemented that binding. The keycap is hidden for coarse pointers and icon-only triggers.

## API reference

| Prop | Values | Default |
| --- | --- | --- |
| `variant` | `"solid" \| "subtle" \| "outline" \| "ghost"` | `"subtle"` |
| `tone` | `"default" \| "danger"` | `—` |
| `size` | `"2xs" \| "xs" \| "sm" \| "md" \| "lg" \| "xl" \| "2xl"` | `"sm"` |
| `loading` | `boolean \| "retain-focus"` | `—` |
| `label` | `string` | `Required` |
| `iconOnly` | `boolean` | `false` |
| `fullWidth` | `boolean` | `false` |
| `shortcut` | `string \| readonly string[]` | `—` |
| `title` | `Inherited native HTML prop` | `label` |
| `Native HTML props` | `Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children" \| "aria-label" \| "type">` | `Forwarded` |
