Xzero UI
Pro library

Expandable card

Give a dense card more room when requested.

$ pnpm dlx shadcn@4.23.0 add @xzero-ui/expandable-card
Live · keyboard ready

When to use

When not to use

Installation

Register both Xzero UI namespaces in your project's components.json:

{
  "registries": {
    "@xzero-ui": "https://mcp.xzero.co.uk/r/{name}.json",
    "@xzero-ui-pro": "https://mcp.xzero.co.uk/r/pro/{name}.json"
  }
}
npx shadcn@4.23.0 add @xzero-ui/expandable-card

Install xzero-foundation once, and import @/components/xzero/foundation.css in your app root. No Xzero token is used by this snapshot. For sample portraits, photos, fonts, or logos, download https://mcp.xzero.co.uk/install-assets.mjs and run node xzero-install-assets.mjs <receiving-project>.

Usage

import { ExpandableCard } from "@/components/xzero/expandable-card/expandable-card";

export function PlanDetails() {
  return (
    <ExpandableCard title="Pro plan" description="Billed yearly, renews March 4" width={400} expandedWidth={600}>
      <ul>
        <li>Unlimited projects</li>
        <li>Priority support</li>
      </ul>
    </ExpandableCard>
  );
}

API reference

ExpandableCard

A card whose header toggles a details panel beneath it.

PropTypeDefaultDescription
title (required)string–Card heading, shown in the toggle.
descriptionstring–Summary line. Changed words roll in when it updates.
children (required)ReactNode–Details revealed when expanded.
defaultExpandedbooleanfalseStarts expanded.
widthnumber–Collapsed width cap in px. The card is centered and never wider than its container. Fills the container when omitted.
expandedWidthnumber–Expanded width cap in px, so the card grows sideways into more room when opened. Defaults to width.

Keyboard interactions

KeysAction
Enter / SpaceToggles the card from its header button.
EscapeCloses the card while focus is inside it and returns focus to the header.

Accessibility

Motion

Responsive behavior

Performance

Notes for AI

Also in expand

Guidance for AI tools

Expandable card: Give a dense card more room when requested. Follow the declared prop types and do not invent props. Keep keyboard access, reduced motion support, and both light and dark themes intact when adapting it.

Full library index: https://ui.xzero.co.uk/llms.txt

Browse all components