Card

Groups related content and actions.

  • Composed
  • Liquid Glass on iOS 26
  • In the first release
import { Card, cardPrimitive } from "nitro-ui-sdk/card";
HeroUI Native
Card
Expo UI
Card
  • Card example screen, light appearance
    Light
  • Card example screen, dark appearance
    Dark
  • Card example screen, liquid glass appearance
    Liquid Glass
On this page

A card groups related content and actions on one surface: a summary, a route, a settings preview. A static card is a plain container and its children keep their own semantics and actions. A pressable card is one button: the whole surface opens something, so it holds no other controls.

Use Surface for a bare themed container without card anatomy, and ListGroup for rows of settings or navigation.

Anatomy

import { Card } from "nitro-ui-sdk/card";

<Card.Root>
  <Card.Header>
    <Card.Title>Route 12</Card.Title>
    <Card.Description>Six stops</Card.Description>
  </Card.Header>
  <Card.Body />
  <Card.Footer />
</Card.Root>
Part Description
Root The surface: a token fill (with shadow.surface in light mode), an outline or Liquid Glass, with radius.card. Pressable when it has onPress.
Header Stacks the title and description. Built from title and description when Root has no children.
Title The card’s heading, in the headings rotor.
Description Secondary text under the title, muted.
Body Main content. A string renders as body text; anything else lays out in a column.
Footer Actions or metadata in a wrapping row. A string renders as a footnote.

Usage

import { Card } from "nitro-ui-sdk/card";

<Card.Root title="Weekly summary" description="Twelve deliveries completed." />;

Variants and sizes

Variant Look
default surface fill, shadow.surface in light mode.
secondary surfaceSecondary fill, no shadow.
tertiary surfaceTertiary fill, no shadow.
outline No fill, a 1 pt border line.
glass Liquid Glass through MaterialView, opaque fallback otherwise.

Sizes sm | md | lg (default md) set the padding (spacing.md, lg, xl), the gap and the type steps (title headline or title3, description footnote or subheadline).

import { Card } from "nitro-ui-sdk/card";

<Card.Root variant="outline" size="lg">
  <Card.Header>
    <Card.Title>Route 12</Card.Title>
    <Card.Description>Six stops, 14 km</Card.Description>
  </Card.Header>
  <Card.Body>Next pickup at 9:00.</Card.Body>
  <Card.Footer>Updated just now</Card.Footer>
</Card.Root>;

States

  • Pressed (pressable only): the card springs to motion.pressedScale while the touch is down and springs back on release. The scale runs natively; Reduce Motion switches it without animation.
  • Disabled (pressable only): opacity.disabled, no press from touch, VoiceOver, the agent or the controller.
import { Card } from "nitro-ui-sdk/card";

<Card.Root label="Open route" onPress={() => {}} title="Route 12" disabled />;

Liquid Glass

variant="glass" draws the card on MaterialView. Glass is drawn only when the theme draws it (theme.material === "glass": requested, iOS 26 or later, transparency not reduced); otherwise the card shows the opaque overlay fill with a border. Glass belongs over media and maps, not behind long body text: keep glass cards short.

Props

Root

Prop Type Default Description
variant "default" | "secondary" | "tertiary" | "outline" | "glass" "default" Surface treatment.
size "sm" | "md" | "lg" "md" Padding and type size.
title string Builds the default header when there are no children.
description string Builds the default header when there are no children.
styles CardStyles Per-part style resolvers.
layout LayoutStyleProps Layout of the card.
children ReactNode Card content.
onPress (details: ActionDetails) => void Makes the whole card one button.
label string Required with onPress: the spoken and agent name.
hint string VoiceOver hint of a pressable card.
disabled boolean false Pressable cards only.
haptic HapticStyle | "none" "light" Impact felt on a touch press.
api Controller<CardActions> Controller from cardPrimitive.createApi().
agentId string Stable agent identity.
confirm Confirmation Localized confirmation the agent must pass before pressing.
Prop Type Default Description
part CardPart the part’s own name Resolve another part’s style.
children ReactNode Content. Body and Footer render a string as text.

Title, Description

Prop Type Default Description
part CardPart "title" / "description" Resolve another part’s style.
children string The text.

Controller API

import { Card, cardPrimitive } from "nitro-ui-sdk/card";

const api = cardPrimitive.createApi();
<Card.Root label="Open route" onPress={() => {}} api={api} title="Route 12" />;
api.current?.press();
Action Signature Result
press press(source?: ActionSource): ActionStatus accepted, disabled, refused (handler called preventDefault()) or unavailable.

Only a pressable card attaches a controller.

Styles

import { Card, type CardStyles } from "nitro-ui-sdk/card";

const styles: CardStyles = {
  root: ({ tokens, state }) => ({ style: { opacity: state.disabled ? 0.3 : 1 } }),
  title: ({ tokens, variant }) => ({
    text: { color: variant === "glass" ? tokens.colors.foreground : tokens.colors.accent },
  }),
};
<Card.Root styles={styles} title="Weekly summary" />;

Resolvers receive { tokens, variant, size, state } with state: { pressable: boolean; disabled: boolean }. Custom children opt in with part or useCardPart(props, "body").

Accessibility

  • A static card is not an accessibility element; VoiceOver reaches its children one by one. Title is a heading.
  • A pressable card is one button named by label, with hint and the disabled trait. Its content is read through the label, so keep the label complete (e.g. “Route 12, six stops”).
  • Touch, VoiceOver activation, the agent and the controller share one press path. Only touch plays the haptic.

Agent API

Action Arguments Notes
press none Pressable cards only: component Card, role button, named by label. Asks for confirm when set.

A static card is read-only and adds no entry; its children register themselves.

Platform notes

iOS Android
Surface Composed View with token fill and boxShadow. Verified in the iOS harness. Same composed view. Shadows require renderer support (API 31 or later). Written, compile-only on this machine.
Pressed scale Native KitPressScale (ios/layout/HybridNativePressScale.swift) follows the inner control’s touch events and springs the card; no JavaScript during the press. HybridNativePressScale.kt scales on touch with an overshoot release; written, compile-only.
Glass MaterialView Liquid Glass on iOS 26+, opaque fallback otherwise. Opaque fallback.