Skip to content

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

Updated 2026-11-12

Playground

Change the props. The controls come from the documented props.
tsx
<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.
  1. triggerSecondary button with the shortcut hint.
  2. search-fieldLabelled search input, focused on open.
  3. groupResult group with a header.
  4. 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.
SearchDialog props
NameTypeDefaultDescription
indexUrl (required)string–URL of the JSON index, loaded on first open.
groupOrderstring[]–Result groups in display order.
labelstring"Search"Visible label of the trigger.

Tokens used

Derived from the utility classes in the component's source. Copy a class with one click.
Tokens used by SearchDialog
TokenTierValueUtility
button.radiuscomponent9999px
dialog.backdropcomponentrgba(10,10,11,0.20)
dialog.bgcomponent#FFFFFF
dialog.bordercomponentrgba(10,10,11,0.08)
dialog.radiuscomponent16px
input.bgcomponent#FAFAF7
input.bordercomponent#8A8578
input.heightcomponent48px
input.paddingXcomponent16px
input.radiuscomponent8px
search.kbdBordercomponentrgba(10,10,11,0.08)
search.kbdFgcomponent#555555
search.resultBgActivecomponent#E7E3DA
search.resultsHeightcomponent320px
focussemantic#C6492E
spacing.0semantic0px
spacing.16semantic64px
spacing.2semantic8px
spacing.3semantic12px
spacing.4semantic16px
surface.pagesemantic#FAFAF7
text.primarysemantic#0A0A0B
text.secondarysemantic#555555
type.body.sizesemantic16px
type.small.sizesemantic14px
weight.mediumsemantic500
weight.semiboldsemantic600

Accessibility

What is checked automatically on every build, and what a person has tested. Nothing is marked as tested unless it was.
Testing status by check
CheckHowStatus
axe-core rulesAutomated on every npm run check, at desktop and mobile widthRuns on every build
KeyboardAutomated Playwright test (scripts/keyboard.mjs)Tested
Screen readerManualNot tested yet

Keyboard

SearchDialog keyboard interactions
KeyAction
Cmd+K / Ctrl+KOpens or closes search from anywhere.
Arrow up / downMoves through the results.
EnterOpens the active result.
EscCloses 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

SearchDialog contrast pairings
PairingRatio (x:1)MinimumStatus
text.primary on surface.page18.924.5Pass
text.primary on surface.card19.794.5Pass
text.secondary on surface.page7.134.5Pass
text.secondary on surface.card7.464.5Pass
border.control on surface.page3.523.0Pass
border.control on surface.card3.683.0Pass
focus on surface.page4.573.0Pass
focus on surface.card4.783.0Pass
text.primary on surface.subtle15.454.5Pass
text.secondary on surface.subtle5.824.5Pass