Expandable cardPro
A dense card that gives itself more room on request: width and height morph together, details fade in after the box has made room, Escape closes from inside.
oxyn add expandable-cardThe preview stays free for everyone. Pro opens the code of every Pro component, screen, agent-app template, block and kit, plus the Pro CLI.
Rendered from Rust at build time · goes live when visible
When to use
- A dense card that gives itself more room on request: a header button with an icon, title and a one-line description (a changed description rises in), and a body that opens.
- Width (width → expanded_width) and height morph together; details fade in after the box has made room and fade out before it shrinks; the card centres and never exceeds its container (0 fills).
- Escape closes from inside.
When not to use
- A modal window on a dimmed backdrop: use Dialog instead.
- The dialog docked to an edge for inspectors and run details: use Sheet instead.
- Nested sheets with depth: use Sheet stack instead.
Installation
Expandable card is part of Oxyn Pro; the preview is free. Pro items install with the oxyn CLI once your licence is signed in; until then Pro members copy the code from this page.
oxyn add expandable-cardUsage
The preview is free. Pro opens the code of every Pro component, screen and template.
Examples
Collapsed
Dense card that grows sideways and down when opened.
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
Open
Started open.
web ✓ 41s api ✓ 58s worker ✓ 35s
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
Fill
Fills its container.
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
Failed
A changed description rolls in.
web ✓ 41s api ✕ migration 0042 failed worker ✓ 35s
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
API reference
ExpandableCard
| Prop | Type | Default | Description |
|---|---|---|---|
titlerequired | String | — | Title. |
descriptionrequired | String | — | Summary line. |
icon | String | "tool" | Icon. |
expandedrequired | bool | — | Expanded. |
width | u32 | Default::default() | Collapsed width cap px (0 = fill). |
expanded_width | u32 | Default::default() | Expanded width cap px (0 = width). |
on_toggle | EventHandler<bool> | — | Toggled. |
childrenrequired | Element | — | Details. |
Read from the Rust signature and doc comments.
Keyboard interactions
| Key | Action |
|---|---|
| EnterorSpace | Toggle from the header |
| Escape | Close from inside, focus stays on the header |
Accessibility
- Header button with aria-expanded; the closed body is aria-hidden.
From the spec
- Header button with aria-expanded; the closed body is aria-hidden.
Motion & interaction
Timing
- Width and grid rows move over 320 ms on cubic-bezier(.2,.8,.2,1); details fade in 160 ms after.
- Reduced motion: no entrance rise or row stagger, no shimmer (static muted text), chevrons and the card morph jump to their end state.
Responsive behaviour
- Width caps never exceed the container; it centres.
Edge cases (spec)
- Width caps are max-width 100 %.
Notes for AI
- Import
ExpandableCardfromoxyn_dioxusand includeSTATUS_INDICATOR_CSSplus the token stylesheet once. - A GPUI version exists:
ExpandableCardElinoxyn_gpui. - Props to set first:
title,description,expanded,children. - Keep its states and timings as they ship; restyle it through the CSS variables rather than by hand.