Troupe tokens

Card

A frame with named slots: media, header, body, actions. The card places them and never styles what is inside; the content here is Text and Button. No JavaScript. Switch the brand: radius, inset, spacing and shadow change through semantic tokens, the slots stay where they are.

Variants × slots

Default: data-variant="elevated", which also applies when the attribute is missing. The variant changes the frame only, never the slots. Every slot is optional; a missing slot takes no space and leaves no gap.

elevated

full

Autumn season

Three plays, one evening. Doors open at seven; the first curtain rises at half past.

no-media

Autumn season

Three plays, one evening. Doors open at seven; the first curtain rises at half past.

header-body

Autumn season

Three plays, one evening. Doors open at seven; the first curtain rises at half past.

outlined

full

Autumn season

Three plays, one evening. Doors open at seven; the first curtain rises at half past.

no-media

Autumn season

Three plays, one evening. Doors open at seven; the first curtain rises at half past.

header-body

Autumn season

Three plays, one evening. Doors open at seven; the first curtain rises at half past.

Equal height

When a layout stretches cards to the same height, body grows and actions stays at the end of every card.

Matinee

Sunday at two.

Evening

Three plays, one evening. Doors open at seven; the first curtain rises at half past.

Two intervals. The bar is open throughout.

Unknown slot

Only the slots in card.api.json are placed. A direct child with another data-slot value, or with none, is not rendered: it is not visible, takes no space, leaves no gap and is not in the accessibility tree. The two cards below are identical; the second one also contains <div data-slot="footer"> and a bare <p>.

Known slots only

Header and body.

Known slots only

Not a Card slot: never placed.

Header and body.

No data-slot: never placed.

Reduced motion

The card has no states and no motion: no hover lift, no transitions. Motion inside a slot belongs to the slot's content; the buttons above follow Button's own reduced-motion rule (ADR 0003).

Usage

<link rel="stylesheet" href="@iahola/troupe-tokens/troupe.css">
<link rel="stylesheet" href="@iahola/troupe-components/card/styles.css">
<link rel="stylesheet" href="@iahola/troupe-components/text/styles.css">
<link rel="stylesheet" href="@iahola/troupe-components/button/styles.css">

<article class="troupe-card" aria-labelledby="card-title">
  <div data-slot="media"><img src="ensemble.jpg" alt="The ensemble on stage"></div>
  <header data-slot="header">
    <h3 class="troupe-text" data-variant="title" id="card-title">Autumn season</h3>
  </header>
  <div data-slot="body">
    <p class="troupe-text">Three plays, one evening.</p>
  </div>
  <div data-slot="actions">
    <button type="button" class="troupe-button">Book</button>
    <button type="button" class="troupe-button" data-variant="ghost">Details</button>
  </div>
</article>

Root: <article> for a self-contained card (default), <section aria-labelledby> for a named part of the page, <div> for visual grouping only. Full specification: packages/components/card/README.md.