Skip to content
nexubDesign System
v12.7.0

Components · Layout

Card

StableAdded v0.0.1 · updated v1.6.0

Surface container for grouping related content. Supports flat, surface, and interactive variants.

import { Card } from '@nexub/react';
View as Markdown

Playground

Playground

Live
Card title

Cards group related content on a raised surface.

TSX
<Card variant="surface" />

Examples

Default

Card title

Cards group related content on a raised surface.

Variants

Flat

Surface

Interactive

The whole card is one link named by its title. The button sits above the link with `relative z-[1]`.

Atlas

Updated 2 hours ago

Sheen

Move the pointer over the card.

Pro

Everything in Team, plus audit logs.

Showcase (marketing mode)

Product accents on showcase cards, inside `data-mode="marketing"`.

Payub

Payroll and HR

Bookub

Bookkeeping

Tilt

`effect="tilt"` (4.3): the card leans toward the pointer and the sheen catches the light. Hover with a mouse.

Revenue

$68,420

Customers

1,204

States

  • Card title

    Cards group related content on a raised surface.

    default
  • Card title

    Cards group related content on a raised surface.

    variant="flat"
  • Card title

    Cards group related content on a raised surface.

    variant="surface"
  • Card title

    Cards group related content on a raised surface.

    variant="interactive"
  • Card title

    Cards group related content on a raised surface.

    variant="showcase"
  • Card title

    Cards group related content on a raised surface.

    tone="neutral"
  • Card title

    Cards group related content on a raised surface.

    tone="info"
  • Card title

    Cards group related content on a raised surface.

    tone="success"
  • Card title

    Cards group related content on a raised surface.

    tone="warning"
  • Card title

    Cards group related content on a raised surface.

    tone="danger"
  • Card title

    Cards group related content on a raised surface.

    tone="leap"
  • Card title

    Cards group related content on a raised surface.

    tone="bookub"
  • Card title

    Cards group related content on a raised surface.

    tone="payub"

Props

Props
PropTypeDefaultDescription
variant'flat' | 'surface' | 'interactive' | 'showcase''flat'interactive lifts 2px on hover (spatial spring, elevation 1 → 2), sinks to 0.99 on press and adds a state layer. Use it for cards that are links or buttons. showcase is the marketing-mode card (24px corners, soft shadow, hover lift); a flat card outside data-mode="marketing".
accent'leap' | 'bookub' | 'payub' | 'founderub' | 'people' | 'contracts' | 'forms' | 'commerce' | 'money' | 'capital' | 'mind' | 'go' | 'command-hub' | 'runner' | 'book-hub' | 'payhub' | 'founder-hub' | 'os' | 'fintech' | 'intelligence' | 'autonomous'—With variant="showcase": an app- or division-coloured top edge and tint in marketing mode. An app key sets data-product, a division key data-division. Keys beyond leap, bookub, payub and founderub need @nexub/themes/products or @nexub/themes/divisions. Only for product-specific content.
effect'none' | 'sheen' | 'tilt''none'Opt-in. sheen is a soft light that follows the pointer, with a brighter rim near the edge. tilt (4.3) also leans the card toward the pointer in 3D. Off for touch, reduced motion and reduced transparency.
tone'neutral' | 'info' | 'success' | 'warning' | 'danger' | 'leap' | 'bookub' | 'payub' | 'founderub'—Applies a semantic left-border accent.
asChildbooleanfalseMerges props onto the immediate child element.
surface'solid' | 'glass''solid'Liquid-glass material treatment — see Foundations → Materials.
CardLinkAnchorHTMLAttributes & { asChild?: boolean }—Put it around the card title to make the whole card one link. Its ::after covers the card and the card shows the focus ring. Give other controls inside the card relative z-[1]. Use asChild for a router link.

Design tokens

Card reads these component tokens. Each one is unset by default and falls back to the semantic role it aliases, so nothing changes until you set it. Set one on any element to restyle every Card below it, and leave the roles other components share alone. See the three token tiers.

Card design tokens
TokenAliasesNotes
--card-bg--color-surface-elevated—
--card-fg--color-on-surface—
--card-border--color-outline-variantAt 60% opacity.
--card-radius--shape-container—
CSS
/* One area of your app */
.checkout {
  --card-bg: var(--color-secondary);
}

Accessibility

ARIA roles

region (when used as a landmark)

Keyboard

  • Tab

    Focuses interactive children. The card itself is never focusable; with a CardLink, the link is.

Focus

  • With a CardLink inside, the focus ring is drawn on the card, not around the title.

  • Prefer CardLink over wrapping the whole card in `<a>`: the link’s accessible name stays the title instead of every word on the card.

Screen reader

  • Group related content with a heading inside the Card so AT users can navigate by heading level.