Overlays
SearchDialog
Site search in a modal, opened from the header or with Cmd+K / Ctrl+K. Results are grouped.
- Experimental
- Keyboard tested
- Screen reader not tested yet
Playground
Change the props. The controls come from the documented props.
<SearchDialog indexUrl="/search.json" />Usage
When to use
Use the search dialog once per site, opened from the header or with Ctrl+K (Cmd+K on a Mac), to find pages, components and tokens.
When not to use
- To filter a list on the current page: use FilterChips.
- For settings or filters inside search.
How it works
A modal with a search field and grouped results. The field keeps focus while the arrow keys move through the results; Enter opens one. Esc closes the dialog and focus returns to where it was. The trigger announces the shortcut.
Content guidelines
Result titles are the page titles; descriptions are the one-line descriptions from the site registry, so they stay consistent with the navigation.
Do and don’t
Do
- Render it once per page, in the header.
Don’t
- Don't put filters or settings in the search dialog.
Anatomy
The parts of the component and what each one does, as in the playground above.
- triggerSecondary button with the shortcut hint.
- search-fieldLabelled search input, focused on open.
- groupResult group with a header.
- resultTitle and one-line description; the active result has a subtle fill.
Examples
Type-checked, and the same code goes into the AI manifest. Import: import { SearchDialog } from "@/ds";
In the header
Props
Checked against the component's TypeScript type on every build.
| Name | Type | Default | Description |
|---|---|---|---|
| indexUrl (required) | string | – | URL of the JSON index, loaded on first open. |
| groupOrder | string[] | – | Result groups in display order. |
| label | string | "Search" | Visible label of the trigger. |
Tokens used
Derived from the utility classes in the component's source. Copy a class with one click.
| Token | Tier | Value | Utility |
|---|---|---|---|
| button.radius | component | 9999px | |
| dialog.backdrop | component | rgba(10,10,11,0.20) | |
| dialog.bg | component | #FFFFFF | |
| dialog.border | component | rgba(10,10,11,0.08) | |
| dialog.radius | component | 16px | |
| input.bg | component | #FAFAF7 | |
| input.border | component | #8A8578 | |
| input.height | component | 48px | |
| input.paddingX | component | 16px | |
| input.radius | component | 8px | |
| search.kbdBorder | component | rgba(10,10,11,0.08) | |
| search.kbdFg | component | #555555 | |
| search.resultBgActive | component | #E7E3DA | |
| search.resultsHeight | component | 320px | |
| focus | semantic | #C6492E | |
| spacing.0 | semantic | 0px | |
| spacing.16 | semantic | 64px | |
| spacing.2 | semantic | 8px | |
| spacing.3 | semantic | 12px | |
| spacing.4 | semantic | 16px | |
| surface.page | semantic | #FAFAF7 | |
| text.primary | semantic | #0A0A0B | |
| text.secondary | semantic | #555555 | |
| type.body.size | semantic | 16px | |
| type.small.size | semantic | 14px | |
| weight.medium | semantic | 500 | |
| weight.semibold | semantic | 600 |
Accessibility
What is checked automatically on every build, and what a person has tested. Nothing is marked as tested unless it was.
| Check | How | Status |
|---|---|---|
| axe-core rules | Automated on every npm run check, at desktop and mobile width | Runs on every build |
| Keyboard | Automated Playwright test (scripts/keyboard.mjs) | Tested |
| Screen reader | Manual | Not tested yet |
Keyboard
| Key | Action |
|---|---|
| Cmd+K / Ctrl+K | Opens or closes search from anywhere. |
| Arrow up / down | Moves through the results. |
| Enter | Opens the active result. |
| Esc | Closes search. |
Semantics and focus
- React Aria Autocomplete: the input stays focused, arrow keys move a virtual focus through the results.
- Modal with focus trap; Esc closes and focus returns to where it was.
- The trigger announces the shortcut with aria-keyshortcuts.
Contrast
| Pairing | Ratio (x:1) | Minimum | Status |
|---|---|---|---|
| text.primary on surface.page | 18.92 | 4.5 | Pass |
| text.primary on surface.card | 19.79 | 4.5 | Pass |
| text.secondary on surface.page | 7.13 | 4.5 | Pass |
| text.secondary on surface.card | 7.46 | 4.5 | Pass |
| border.control on surface.page | 3.52 | 3.0 | Pass |
| border.control on surface.card | 3.68 | 3.0 | Pass |
| focus on surface.page | 4.57 | 3.0 | Pass |
| focus on surface.card | 4.78 | 3.0 | Pass |
| text.primary on surface.subtle | 15.45 | 4.5 | Pass |
| text.secondary on surface.subtle | 5.82 | 4.5 | Pass |