Components · Data Display
Card
A raised container for related content, with an optional clickable version.
Component Workbench
Switch between the live interactive preview, syntax-highlighted implementation code, copyable AI coding agent prompt, and designer anatomy blueprint.
Card · Canonical Spec
Production Cluster
Three nodes in eu-west-1.
All workloads are healthy and scheduled.
<article class="as-card">
<header class="as-card__header">
<h3 class="as-card__title">Production Cluster</h3>
<p class="as-card__description">Three nodes in eu-west-1.</p>
</header>
<p class="as-card__body">All workloads are healthy and scheduled.</p>
<footer class="as-card__footer">
<button type="button" class="as-button as-button--secondary"><span class="as-button__label">View Details</span></button>
</footer>
</article> # Aster Component Implementation Prompt — Card
## 1. Component Purpose & Canonical Role
- **Component:** Card (`card`)
- **Category:** Data Display
- **Native Element:** `<article>`
- **Summary:** A raised container for related content, with an optional clickable version.
- **When to Use:** Grouping related content, such as a summary with its actions.
- **When Not to Use:** Page layout, or a single line of text.
## 2. Authoritative Repository Files
- **Component CSS:** `components/card/card.css`
- **Component Spec:** `docs/components/card.md`
- **Agent Contract:** `skills/using-aster-components/SKILL.md`
- **Compiled Bundle:** `dist/css/aster.css`
## 3. Canonical HTML Structure & Classes
```html
<article class="as-card">
<header class="as-card__header">
<h3 class="as-card__title">Production Cluster</h3>
<p class="as-card__description">Three nodes in eu-west-1.</p>
</header>
<p class="as-card__body">All workloads are healthy and scheduled.</p>
<footer class="as-card__footer">
<button type="button" class="as-button as-button--secondary"><span class="as-button__label">View Details</span></button>
</footer>
</article>
```
## 4. Measured Geometry
Measured from the rendered component when this page loads.
## 5. Non-Negotiable Aster Constraints
1. Bind colors to `--as-semantic-color-*` tokens, never primitives or hex values.
2. Use the radius tokens, with 4px as the smallest component radius.
3. Aster has one standard density, with no compact mode.
4. Keep text at 4.5:1 contrast and interactive elements keyboard operable.
## 6. Verification Commands
```bash
npm run test:components
npm run test:browser
``` When to use it
Do
- Group things that belong together.
- Make the whole card a link when it leads to one place.
Don't
- Put buttons inside a fully clickable card.
- Use cards to lay out a whole page.
Variants & States
Every option, rendered live with real styles.
Accessibility & Keyboard Interaction
Requirements for using this component accessibly.
| Topic | Requirement |
|---|---|
| Heading | Use a real heading element for the title. |
| Clickable cards | Use a native link, with no other controls inside. |
| Reduced motion | The hover lift turns off. |
Tokens
Values update with the current theme.
| Role | Token | Current value |
|---|---|---|
| Surface | --as-semantic-color-surface-card | |
| Shadow | --as-semantic-elevation-shadow-card | |
| Padding | --as-space-6 | |
| Radius | --as-radius-lg |