# Web search

One web search an agent ran: the query and the count it reported on one line, the pages it returned behind the fold.

Live variants: https://design.arcadia.is/components/web-search

```tsx
import { WebSearch } from "@arcadia/ui";
```

```tsx
import { MessageGroup, Bubble, WebSearch } from "@arcadia/ui";

<div {...sx(null, WebSearchStyles.stack)}>
  <MessageGroup side="end"><Bubble side="end">Will the runner cache survive the move to v4?</Bubble></MessageGroup>
  <WebSearch query="runner cache migration v4" state={{ status: "done", count: PAGES.length }} results={PAGES} defaultOpen />
  <MessageGroup><Bubble>Yes. Entries saved by v3 restore under v4 as long as their keys match.</Bubble></MessageGroup>
</div>
```

## Accessibility

Tab reaches the line only when it has detail to open. Enter and Space toggle the fold without moving focus. Each page is a real link in Tab order only while the fold is open, and opens in a new tab.

Set `announce` only if no other live region reports the search. The region starts silent and speaks once when the search settles: the count, or Search failed.

## API reference

### WebSearch

- `query` (`string`, required): The words searched for, as sent.
- `state` (`WebSearchState`, required): In flight, done or failed.
- `results` (`readonly WebSearchResult[]`, default `[]`): The pages returned so far, in the search's order. They stay listed when the search fails.
- `open` (`boolean`): Controlled open state.
- `defaultOpen` (`boolean`, default `false`): Open when it first draws.
- `onOpenChange` (`(open: boolean, details: OpenChangeDetails) => void`): Called when the header toggles it.
- `icon` (`CollapsibleHeaderProps["icon"]`)
- `chevron` (`CollapsibleHeaderProps["chevron"]`)
- `announce` (`boolean`, default `false`): Announce the outcome politely when the search settles. Leave off where the conversation already announces it.
- `rootStyle` (`RootStyle<CollapsibleKnobs>`): Typed StyleX override: where the line sits and its `--collapsible-*` knobs.
