Components · Navigation & Layout
Accordion
Stacked sections that open and close, so people can skip what they don't need.
Component Workbench
Switch between the live interactive preview, syntax-highlighted implementation code, copyable AI coding agent prompt, and designer anatomy blueprint.
Accordion · Canonical Spec
Pods are drained gracefully with health probe verification before terminating existing replicas.
Workloads are spread evenly across three availability zones with automatic cross-zone failover.
<div class="as-accordion" data-single="true">
<div class="as-accordion__item">
<h3 class="as-accordion__heading">
<button type="button" class="as-accordion__trigger" aria-expanded="true" aria-controls="sec-1" id="trig-1">
<span class="as-accordion__title">Zero-Downtime Rollout Strategy</span>
<svg class="as-accordion__chevron" viewBox="0 0 16 16" aria-hidden="true"><polyline points="4 6 8 10 12 6"/></svg>
</button>
</h3>
<div class="as-accordion__panel" id="sec-1" role="region" aria-labelledby="trig-1">
<div class="as-accordion__content">Pods are drained gracefully...</div>
</div>
</div>
</div> # Aster Component Implementation Prompt — Accordion
## 1. Component Purpose & Canonical Role
- **Component:** Accordion (`accordion`)
- **Category:** Navigation & Layout
- **Native Element:** `<h3> + <button aria-expanded>`
- **Summary:** Stacked sections that open and close, so people can skip what they don't need.
- **When to Use:** FAQs, configuration groups, and collapsible architecture details.
- **When Not to Use:** Content that users must read all at once.
## 2. Authoritative Repository Files
- **Component CSS:** `components/accordion/accordion.css`
- **Component Spec:** `docs/components/accordion.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-accordion" data-single="true">
<div class="as-accordion__item">
<h3 class="as-accordion__heading">
<button type="button" class="as-accordion__trigger" aria-expanded="true" aria-controls="sec-1" id="trig-1">
<span class="as-accordion__title">Zero-Downtime Rollout Strategy</span>
<svg class="as-accordion__chevron" viewBox="0 0 16 16" aria-hidden="true"><polyline points="4 6 8 10 12 6"/></svg>
</button>
</h3>
<div class="as-accordion__panel" id="sec-1" role="region" aria-labelledby="trig-1">
<div class="as-accordion__content">Pods are drained gracefully...</div>
</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 optional detail, such as FAQs.
- Write titles that tell people what's inside.
Don't
- Hide information everyone needs to read.
- Nest an accordion inside another accordion.
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 |
|---|---|
| Heading Hierarchy | Trigger button is wrapped in semantic <h3>/<h4>. |
| Arrow Up / Down | Moves focus cyclically between accordion triggers. |
Tokens
Values update with the current theme.
| Role | Token | Current value |
|---|---|---|
| Container Radius | --as-radius-lg | |
| Divider Rule | --as-semantic-color-border-subtle |