Skip to content

Card

Card

A surface that groups related content. Reach for it when a section needs a visible boundary; otherwise use Stack or Box.

Variants

<Card>Default outlined</Card>
<Card variant="elevated">Floating</Card>
<Card variant="flat">Recessed</Card>

Interactive

<Card interactive asChild>
<a href="/profile">Open profile</a>
</Card>

Do / Don’t

  • Do put one primary heading per card.
  • Don’t nest cards more than one level deep — collapse to flat sections instead.
  • Don’t put onClick on the card itself — wrap or render an <a> / <button> child.

Install: @helixui/core

import { Card } from '@helixui/core'

status: stable · since: 0.1.0

Tags: container, surface, elevation, group, panel

Live playground

Open the full editor or source on GitHub.

Anatomy

┌──────────────────────────────────┐
│ │
│ <children> │ ← arbitrary content; helixui recommends Stack inside
│ │
└──────────────────────────────────┘
↑ surface bg + border (outlined) | shadow.md (elevated) | flat (no border, subtle bg)
↑ rounded by radius.lg, padded by space.5

Layout

  • displayblock
  • widthfill
  • heightcontent
  • intrinsicSizefills available width, hugs content height, ~20px internal padding
  • stackabletrue
  • fullBleedfalse

Visual

A rounded rectangle with generous internal padding (space.5) and large radius (radius.lg). outlined shows a 1px subtle border on the default surface, elevated removes the border and uses a soft shadow (shadow.md), flat is borderless with a slightly recessed background tint. With interactive, hover lifts the shadow half a step and focus shows a 2px focus-ring border.

Props

NameTypeDefaultDescription
variant'flat' | 'outlined' | 'elevated'outlinedVisual treatment.
interactivebooleanfalseAdds hover/focus affordance — set on cards that act as links or buttons.

Tokens used

color.bg.surface.default, color.bg.surface.subtle, color.border.default, color.border.strong, color.border.focus, radius.lg, space.5, shadow.md

Accessibility

Notes

  • When interactive, also render an interactive element (<a> or <button>) inside or on top, with appropriate role.
  • The card itself is presentational — do not put onClick on it without a role.

Composes with

ComponentRelationNote
StackchildUse Stack inside Card to control vertical rhythm of contents.
HeadingchildCommon first child as a card title.
TextchildBody content of a card.
ButtonchildAction(s) at the bottom of the card.
SheetalternativeUse Sheet for content that should overlay the page.

Prompt examples

These are the AI prompt → JSX mappings used by the helixui prompt DSL and integrations like Cursor / Claude Code.

“wrap this in a card”

<Card>
<Stack gap={3}>
<Heading size="md">Title</Heading>
<Text>Description goes here.</Text>
</Stack>
</Card>

make a clickable card linking elsewhere

“card that links to /settings”

<Card interactive asChild>
<a href="/settings">
<Stack gap={2}>
<Heading size="sm">Settings</Heading>
<Text size="sm" tone="muted">Manage your account.</Text>
</Stack>
</a>
</Card>

raised hero card on a list page

“elevated card with a CTA”

<Card variant="elevated">
<Stack gap={4}>
<Heading size="lg">Upgrade to Pro</Heading>
<Text>Unlock advanced analytics.</Text>
<Button>Upgrade</Button>
</Stack>
</Card>