Xzero UI
Pro library

Card

A contained group of related content and actions.

$ pnpm dlx shadcn@4.23.0 add @xzero-ui/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/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 { Card } from "@/components/xzero/card/card";
import { Avatar } from "@/components/xzero/avatar/avatar";

export function ProjectCard() {
  return (
    <Card
      title="Harbour redesign"
      description="New booking flow and room pages."
      media={<img src="/harbour.jpg" alt="" />}
      avatar={<Avatar name="Maya Chen" size="sm" />}
      meta="Maya Chen"
      status="Updated 2 hours ago"
      details={<p>Scope, milestones, and open questions.</p>}
    />
  );
}

API reference

Card

A content card with optional media, byline, and action that can grow into a quick look dialog.

PropTypeDefaultDescription
title (required)string–Card heading. Becomes the dialog trigger when details is set.
descriptionstring–Supporting line under the title.
mediaReactNode–Image or visual at the top. Zooms slightly on hover.
actionReactNode–Trailing footer control, such as a button.
avatarReactNode–Small leading visual in the footer, such as the owner's avatar.
metaReactNode–Who the card belongs to, shown in the byline.
statusstring–Short status under the meta, such as "Updated 2 hours ago". Changes roll in word by word and are announced politely.
detailsReactNode–Quick look content. When set, the card opens into a larger Radix dialog.
openboolean–Controlled quick look state.
defaultOpenbooleanfalseInitial quick look state when uncontrolled.
onOpenChange(open: boolean) => void–Called when the quick look opens or closes.
childrenReactNode–Extra body content between the description and footer.
...propsHTMLAttributes<HTMLElement>–Forwarded to the root article.

Keyboard interactions

KeysAction
Enter / SpaceOn the title, opens the quick look when details is set.
EscapeCloses the quick look and returns focus to the title.
TabStays trapped inside the open quick look.

Accessibility

Motion

Responsive behavior

Performance

Notes for AI

Also in cards

Guidance for AI tools

Card: A contained group of related content and actions. 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