Components · Overlays & Dialogs
Popover
A small floating card attached to a button.
Component Workbench
Switch between the live interactive preview, syntax-highlighted implementation code, copyable AI coding agent prompt, and designer anatomy blueprint.
Popover · Canonical Spec
Filter Preferences
Display healthy worker instances only. Click the red dot button or outside to dismiss.
<div class="as-popover-anchor">
<button type="button" class="as-button as-button--secondary as-popover-trigger" id="pop-btn" aria-haspopup="dialog" aria-expanded="false">
<span class="as-button__label">Filter Pods</span>
</button>
<div class="as-popover" role="dialog" aria-labelledby="pop-btn" hidden>
<div class="as-popover__header">
<h4 class="as-popover__title">Filter Preferences</h4>
<button type="button" class="as-popover__close" data-popover-close aria-label="Close popover"></button>
</div>
<div class="as-popover__body">Display healthy worker instances only.</div>
</div>
</div> # Aster Component Implementation Prompt — Popover
## 1. Component Purpose & Canonical Role
- **Component:** Popover (`popover`)
- **Category:** Overlays & Dialogs
- **Native Element:** `<div role="dialog">`
- **Summary:** A small floating card attached to a button.
- **When to Use:** Quick inline filter cards, contextual metadata inspectors, or setting callouts.
- **When Not to Use:** Plain text labels without interactive controls (use Tooltip).
## 2. Authoritative Repository Files
- **Component CSS:** `components/popover/popover.css`
- **Component Spec:** `docs/components/popover.md`
- **Agent Contract:** `skills/using-aster-components/SKILL.md`
- **Compiled Bundle:** `dist/css/aster.css` and `dist/js/aster.js`
## 3. Canonical HTML Structure & Classes
```html
<div class="as-popover-anchor">
<button type="button" class="as-button as-button--secondary as-popover-trigger" id="pop-btn" aria-haspopup="dialog" aria-expanded="false">
<span class="as-button__label">Filter Pods</span>
</button>
<div class="as-popover" role="dialog" aria-labelledby="pop-btn" hidden>
<div class="as-popover__header">
<h4 class="as-popover__title">Filter Preferences</h4>
<button type="button" class="as-popover__close" data-popover-close aria-label="Close popover"></button>
</div>
<div class="as-popover__body">Display healthy worker instances only.</div>
</div>
</div>
```
## 4. Measured Geometry
Measured from the rendered component when this page loads.
## 5. Non-Negotiable Aster Constraints
1. **Zero Primitive Color Leaks:** Bind colors strictly to `--as-semantic-color-*` custom properties. Never use `--as-color-primitive-*` or hardcoded hex values in component usage.
2. **Minimum 4px Radius Policy:** Never use `2px` border-radius. Use `--as-radius-sm` (`4px`), `--as-radius-md` (`8px`), `--as-radius-lg` (`12px`), or `--as-radius-full` (`9999px`).
3. **Single Standard Density Mode:** Compact mode (`data-density="compact"` / `.as-*--compact`) is permanently retired. Do not emit compact classes or attributes.
4. **WCAG 2.2 AA Accessibility:** Maintain >= 4.5:1 text contrast, >= 3:1 UI/border contrast, >= 24x24px interactive hit targets, and full keyboard operability (`Tab`, `Enter`, `Space`, `Escape`, Arrow keys).
## 6. Verification Commands
```bash
npm run test:components
npm run test:contrast
npm run test:browser
``` When to use it
Do
- Use it for short content or a few quick controls.
- Close it when people click outside or press Escape.
Don't
- Put critical information only in a popover.
- Use it for plain hints. Use Tooltip instead.
Variants & States
Every option, rendered live with real styles.
Accessibility & Keyboard Interaction
Requirements for using this component accessibly, following the W3C ARIA Authoring Practices Guide.
| Interaction / Key | Behavior & Compliance Requirement |
|---|---|
| Light Dismiss & Close | Dismisses on outside click, Escape key, or .as-popover__close click. |
| ARIA Expanded | Synchronizes aria-expanded="true|false" on the trigger button. |
Tokens
Values update with the current theme.
| Role | Token | Current value |
|---|---|---|
| Card Surface | --as-semantic-color-surface-card | |
| Corner Radius | --as-radius-lg |