Todae

Todae

Card

A bordered surface that groups related content: a plan, a setting, a summary. Its background, border, radius, padding and gap come from the card contract tokens, and the padding and gap follow density. It is the base for a company's own cards and panels.

On this page
import { Button, Card, Text } from '@tounsoo/todae';

export default function CardPlan() {
  return (
    <Card.Root style={{ maxInlineSize: '24rem' }}>
      <Card.Header>
        <Text.Root as="h3">Pro plan</Text.Root>
      </Card.Header>
      <Card.Body>
        <Text.Root>Billed yearly. Renews on 2027-01-04.</Text.Root>
      </Card.Body>
      <Card.Footer>
        <Button.Root variant="secondary">Cancel plan</Button.Root>
        <Button.Root>Change plan</Button.Root>
      </Card.Footer>
    </Card.Root>
  );
}

Pro plan

Billed yearly. Renews on 2027-01-04.

Server Components can import it from @tounsoo/todae/card. That entry has no 'use client' and no hooks; the main @tounsoo/todae entry is a client module.

Every part is a div with no role. Pick the heading level that fits the page; a heading or paragraph directly inside the header has no outer margin. A card that should be a landmark takes role="region" and a name, like any div. A card is not a button or a link: put the actions inside it, in Card.Footer or in the body.

Card.Body grows into the card's free height. When cards in a row stretch to the same height, as grid items do, every footer sits at the bottom edge and the actions line up.

import { Button, Card, Grid, Stack, Text } from '@tounsoo/todae';

const plans = [
  { name: 'Starter', features: ['Three projects.'] },
  { name: 'Pro', features: ['Unlimited projects.', 'Priority support.', 'An audit log for every change.'] },
];

export default function CardRow() {
  return (
    <Grid.Root minItemSize="14rem" style={{ maxInlineSize: '36rem' }}>
      {plans.map((plan) => (
        <Card.Root key={plan.name}>
          <Card.Header>
            <Text.Root as="h3">{plan.name}</Text.Root>
          </Card.Header>
          <Card.Body>
            <Stack.Root as="ul" gap="condensed">
              {plan.features.map((feature) => (
                <li key={feature}>{feature}</li>
              ))}
            </Stack.Root>
          </Card.Body>
          <Card.Footer>
            <Button.Root>Choose {plan.name}</Button.Root>
          </Card.Footer>
        </Card.Root>
      ))}
    </Grid.Root>
  );
}

Starter

  • Three projects.

Pro

  • Unlimited projects.
  • Priority support.
  • An audit log for every change.

Accessible composition

Todae handles: Layout and paint only. Every part is a div with no role, and passes any role or ARIA you give it to that div.

You supply: A heading in Card.Header, at the level that fits where the card sits. For a card that is a landmark, role="region" and a name, best taken from that heading with aria-labelledby. A reusable card should take the heading level as a prop rather than fix it.

import { useId, type ReactNode } from 'react';
import { Card, Text, type TextHeading } from '@tounsoo/todae';

type PanelProps = { title: string; level: TextHeading; children: ReactNode };

export function Panel({ title, level, children }: PanelProps) {
  const id = useId();
  return (
    <Card.Root role="region" aria-labelledby={id}>
      <Card.Header>
        <Text.Root as={level} id={id}>{title}</Text.Root>
      </Card.Header>
      <Card.Body>{children}</Card.Body>
    </Card.Root>
  );
}

Watch for: onClick on Card.Root to make the whole card clickable: a div takes no focus and has no role, so put a real button or link inside it. A link around the whole card makes all of its content the link's name, and a button inside that link nests interactive content. role="region" on every card in a long list, which adds a landmark for each.

When to use

When: A group of content that reads as one unit and sits beside others like it: plans, settings sections, summary tiles.

When not: Content that interrupts the task → Dialog. A message about the page → Alert. Layout spacing with no surface → Stack.

Props

Card.Root props
NameTypeDescription
childrenReact.ReactNode

Card parts, or any content.

Card.Header props
NameTypeDescription
childrenReact.ReactNode

A heading of the level that fits the page, and optional text.

Card.Body props
NameTypeDescription
childrenReact.ReactNode

Body content.

Card.Footer props
NameTypeDescription
childrenReact.ReactNode

Buttons or links.