Skip to content

Card

A Box with slots laid out on it for a title, a subtitle, a body and a footer. Use it for content of the same shape shown repeatedly.

tsx
import { Card } from 'neba';

<Card title="Starter" subtitle="One project" footer={<Button>Choose</Button>}>
  Body
</Card>;

Props

PropTypeDefaultDescription
variantshared'solid' | 'outline' | 'text''outline'Weight of the surface: filled, hairline, or none
sizeshared'xs' | 'sm' | 'md' | 'lg' | 'xl''md'Corner radius, padding, and the type scale of the header and body
colorshared'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'info''primary'Semantic colour role. The surface is white, so it reaches the hairline and the dividers only
densityshared'default' | 'compact''default'Padding only: never the height, never the type scale
elevationshared0 | 1 | 2 | 30Drop shadow depth. Ignored when variant is text
titleReactNodeThe heading. Pass a real heading element when it belongs in the document outline
subtitleReactNodeA second line under the title, one step down the type scale and muted
headerActionReactNodeContent pinned to the end of the header row: a menu button, a status chip
footerReactNodeThe bottom area, laid out as a wrapping row
dividersbooleanfalseSeparates the sections with a hairline instead of space, edge to edge
childrenReactNodeThe card's body
transitionsharedNebaTransitionAn entrance animation, run once on mount (transition="grow"). Wrap it in an Animate* component for a trigger or a replay

Takes every Box prop. The one exception is padded, omitted because a Card redistributes that padding section by section.

Examples

The sections are props rather than sub-components, and a slot you do not pass is not rendered. headerAction is the control slot at the far end of the title row.

dividers

Separates the sections with a rule instead of space. The lines have to reach both edges of the sheet, so the padding moves from the Card onto each section.

size

Sets the sheet's radius and padding together with the type scale of the header and the body. The title sits one step above the body, the subtitle one step below it.

Holding controls

Pass a real heading as title to put it in the document outline: title={<h2>…</h2>}. It inherits the Card's type scale rather than the browser's.

Released under the MIT License