Popover
Rich content in a floating panel, opened by click.
Left out of Content first Only menus and dialogs float in Content first. A long aside opens in place with collapsible instead. Use instead: Collapsible, Dialog
See it live
npm run storybookWhen to use it
- Use it when: Extra detail or a small control next to what it explains, on any device.
- Not when: A one-line hint (tooltip), or a task that should block the page (dialog).
Instead:
Words
- Write to one person: "you", not "users".
- Short sentences with room to breathe.
- Explain why before asking for anything.
- Use: Read, Save for later, You, Next issue. Avoid: Click here, Submit, Users, Content.
The labels components use, from the voice tokens:
content.action.commit: Savecontent.action.cancel: Not nowcontent.action.destroy: Removecontent.action.retry: Try againcontent.action.empty-action: Browse guides
See Voice and tone for the whole voice.
Accessibility and keyboard
| Keyboard | What happens | Not |
|---|---|---|
| undefined | Escape closes it and returns focus. | undefined |
Test before you ship:
- The trigger says it opens a panel and whether it is open. undefined
Use it in code
npx open-ds add popover
The component reads only component keys and semantic tokens, so it follows the brand and mode on <html>.
Tokens it reads
Popover reads 10 tokens of its own, each an alias of a semantic token. Each row is one part: its own token, the semantic it aliases, and the value it ends at. Change a semantic and every component that reads it follows; override one of Popover's tokens to change Popover alone.
Content first decides what changes when you switch theme. Here a switch changes colors only, so the marked rows differ between light and dark; everything else holds steady.
| Part | Its token and the semantic it aliases | Value |
|---|---|---|
| Shared | ||
| Transition panels duration | component.transition.panels-durationmotion.duration.panelsvar(--transition-panels-duration) | duration.relaxed:320ms |
| Content | ||
| Corner | component.popover.content.radiusradius.controlvar(--popover-content-radius) | radius.8:0.5rem |
| Fill Changes with theme | component.popover.content.backgroundcolor.surface.raisedvar(--popover-content-background) | Lightstone.light.0:#FFFFFFDarkstone.dark.100:#2E2A24 |
| Padding | component.popover.content.paddingspace.inset.containervar(--popover-content-padding) | space.24:1.5rem |
| Text Changes with theme | component.popover.content.labelcolor.text.primaryvar(--popover-content-label) | Lightstone.light.900:#1F1B16Darkstone.dark.900:#FFFDF8 |
| Shadow Changes with theme | component.popover.content.shadowelevation.overlayvar(--popover-content-shadow) | Lightshadow.overlayDarkshadow.overlay-dark |
| Header | ||
| Gap | component.popover.header.gapspace.gap.tightvar(--popover-header-gap) | space.8:0.5rem |
| Text size | component.popover.header.font-sizetype.body.font-sizevar(--popover-header-font-size) | font.size.18:1.125rem |
| Title | ||
| Weight | component.popover.title.font-weighttype.label.font-weightvar(--popover-title-font-weight) | font.weight.600:600 |
| Description | ||
| Text Changes with theme | component.popover.description.labelcolor.text.mutedvar(--popover-description-label) | Lightstone.light.600:#61594DDarkstone.dark.400:#A39A8B |
| From the system | ||
| Edge Changes with theme | color.border.default straight from the system, through --border | Lightstone.light.200 · #E4DDD0Darkstone.dark.100 · #2E2A24 |