Overlays
Popover
Small non-modal panel next to its trigger for an explanation or a few details.
- Experimental
- Keyboard tested
- Screen reader not tested yet
Playground
Change the props. The controls come from the documented props.
<Popover trigger="What is a token?" title="Token">
A named value, such as a colour or a spacing, that every component reads.
</Popover>Usage
When to use
Use a popover to explain something right where it appears: a term, a status, a number whose meaning isn't obvious.
When not to use
- For a decision or a form: use Dialog.
- For content most people need: show it on the page.
- For longer content that opens in place: use Disclosure.
How it works
A small button opens a panel next to it. It is a non-modal dialog: focus moves in, Esc or a click outside closes it, and focus returns to the trigger. The panel flips to the other side when there is no room and is 320px wide at most.
Content guidelines
The trigger asks the question people have (“What is the contrast gate?”). The title names the topic, the body answers in one or two sentences.
Do and don’t
Do
- Use it to explain a term, a status or a number where it appears.
Don’t
- Don't put forms or decisions in a popover; use Dialog.
- Don't hide information people need to complete the task.
Anatomy
The parts of the component and what each one does, as in the playground above.
- triggerSmall button in the button style.
- containerCard surface, control border, 12px radius, 320px wide at most.
- titleSemibold heading that names the dialog.
- bodySmall secondary text.
Examples
Type-checked, and the same code goes into the AI manifest. Import: import { Popover } from "@/ds";
Explaining a term
Every colour is checked by the contrast gate.
Props
Checked against the component's TypeScript type on every build.
| Name | Type | Default | Description |
|---|---|---|---|
| trigger (required) | string | – | Label of the trigger button. |
| triggerVariant | "primary" | "accent" | "secondary" | "ghost" | "secondary" | ghost for an inline “What is this?”. |
| title (required) | string | – | Heading inside the popover; names it. |
| children (required) | ReactNode | – | One or two sentences, or a short list. |
| placement | "bottom" | "top" | "bottom" | Preferred side; flips when there is no room. |
Tokens used
Derived from the utility classes in the component's source. Copy a class with one click.
| Token | Tier | Value | Utility |
|---|---|---|---|
| popover.bg | component | #FFFFFF | |
| popover.border | component | #8A8578 | |
| popover.padding | component | 16px | |
| popover.radius | component | 12px | |
| popover.width | component | 320px | |
| spacing.2 | semantic | 8px | |
| text.primary | semantic | #0A0A0B | |
| text.secondary | semantic | #555555 | |
| type.small.size | semantic | 14px | |
| 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 |
|---|---|
| Enter / Space | Opens the popover from its trigger. |
| Esc | Closes it; focus returns to the trigger. |
Semantics and focus
- React Aria dialog without a modal backdrop: focus moves into the popover and returns to the trigger on close.
- The title labels the dialog; Esc and a click outside close it.
Contrast
| Pairing | Ratio (x:1) | Minimum | Status |
|---|---|---|---|
| text.primary on surface.card | 19.79 | 4.5 | Pass |
| text.secondary on surface.card | 7.46 | 4.5 | Pass |
| border.control on surface.card | 3.68 | 3.0 | Pass |