Card
A compound surface for grouped content and actions.
A compound surface for grouped content and actions.
Workspace
12 active members
Security score
94 of 100
Import
Section titled “Import”import { Card } from "@zentara-co/zenos-ui";Anatomy
Section titled “Anatomy”Use the parts only when the layout needs them. Card.Header groups title and description; Card.Action aligns trailing controls in the header row.
<Card> <Card.Media>{/* photo or video */}</Card.Media> <Card.Header> <Card.Title tooltip="Optional context">Workspace</Card.Title> <Card.Description>12 active members</Card.Description> <Card.Action>{/* optional */}</Card.Action> </Card.Header> <Card.Content>{/* body */}</Card.Content> <Card.Footer>{/* actions */}</Card.Footer></Card>Variants
Section titled “Variants”The default surface uses the neutral card fill (background-neutral-card), default border, and rounded-lg corners. Title and description use type-body-l medium and type-body-s regular text.
variant="grey" applies accent gray subtlest fill and a muted border—use it for secondary metrics, nested groups, or quieter dashboards without changing the internal spacing.
Use variant="white" for a white surface in light mode that matches the default card background in dark mode. It uses background-default in light mode and background-neutral-card in dark mode, with text and icons following the active theme. ClickableCard and SelectableCard share this variant; their hover, pressed, selected, and disabled treatments still apply.
default
Neutral card fill with default border.
grey
Subtle gray fill for quieter grouped surfaces.
white
White in light mode; dark in dark mode.
Composition
Section titled “Composition”Compose headers, supporting text, content, and actions only when the card needs them. Comfortable density uses spacing 4 on every outer edge (px-4, pt-4, and pb-4), while adjacent regions meet without duplicate padding. A header followed by content keeps pb-4 (pb-3 at compact density). A header-only card keeps the same balanced inset.
Security posture
Last evaluated 8 minutes ago
18 controls passed and two need review.
Card.Media frames a photo or video inside the card. A 4px inset on the sides, and on the edge that meets the card, is tighter than the copy padding, so the picture reads as framed. The frame radius is the card radius minus that inset and the card border, which keeps the corners concentric. Put overlay badges inside the frame so they anchor to the picture. The frame is aspect-video. Pass another ratio with className. The image or video is a direct child and fills the frame.
Interior kit
48 rooms, 6 moods, every one editable.
Mountain retreat
Media can close the card too.
Density
Section titled “Density”Card supports density="comfortable | compact" and inherits the nearest DensityProvider when the prop is omitted. Compact density reduces region padding and title scale without changing the selected surface or radius. Buttons and inputs nested in the card inherit the same preset unless they set an explicit size.
See the Density foundation for comparison and provider examples.
Custom styling
Section titled “Custom styling”Pass className on Card (or Card.Root) to replace the surface, border, or layout. Prefer semantic tokens so light and dark themes stay coherent. Override title or description color on Card.Title and Card.Description when the root uses a tinted fill.
Layout-only utilities such as max-w-md or w-full leave the built-in variant untouched. Custom classes merge last on the root.
Quarterly campaign
Three audiences and 24 published assets.
Override the root surface with semantic tokens; header spacing and title scales stay the same.
Card or another component
Section titled “Card or another component”Use ClickableCard when the whole surface should activate one action or link. Use SelectableCard for checkbox or radio selection inside forms. Keep static summaries and read-only metrics on Card.
Card.Root Card.Header Card.Title Card.Description Card.Action Card.Content Card.Media Card.Footer
API
| Prop | Type | Default | Description |
|---|---|---|---|
variant | default | grey | white | default | Default uses neutral card fill; grey uses accent gray subtlest fill; white uses background-default and follows the active theme. |
density | comfortable | compact | comfortable | Controls Card spacing and title scale. Inherits from the nearest DensityProvider when omitted. |
tooltip | ReactNode | — | Optional information tooltip on Card.Title. |
Media className | string | — | Merged last on Card.Media. The frame is aspect-video; pass another ratio here. |
className | string | — | Merged last on the root. Use semantic tokens to replace surface and border while keeping internal spacing. |
native props | React.HTMLAttributes<HTMLDivElement> | — | Forwards native attributes, events, aria-*, data-*, className, style, and ref. |
Unless narrowed above, each DOM-rendering part also accepts its underlying native or Base UI props,
including className, style, aria-*, and data-*.
Accessibility
Section titled “Accessibility”Card is a structural div and does not add interaction semantics. Use headings in a logical order, keep action labels meaningful, and use ClickableCard or SelectableCard when the whole surface needs to be interactive.