Card

Card is a flexible surface for grouping related content, media, and actions into one container.

Weekly report

Sent to the team every Monday.

Active

Covers sign-ups, churn and revenue for the last seven days.

tsx
import { Card } from '@/components/ui/wideset/card/Card';
import { StatusBadge } from '@/components/ui/wideset/status-badge/StatusBadge';

<Card>
  <Card.Header>
    <div className="flex items-start justify-between gap-ws-9">
      <div className="flex min-w-0 flex-1 flex-col">
        <Card.Title>Weekly report</Card.Title>
        <Card.Description>Sent to the team every Monday.</Card.Description>
      </div>
      <Card.Action>
        <StatusBadge color="positive">Active</StatusBadge>
      </Card.Action>
    </div>
  </Card.Header>
  <Card.Content>
    <p className="typography-body-md text-ws-static-subtle">Covers sign-ups, churn and revenue for the last seven days.</p>
  </Card.Content>
</Card>

Installation

pnpm dlx wideset add card

Copies the component and any Wideset components it uses into your project.

Examples

Variants

Bordered draws its own surface, for cards that sit directly on the page background or need to read as separate items. Flat drops the border and lets the parent layout do the grouping, for cards inside a panel or a section that already has a frame. Keep one variant per group of cards.

tsx
import { Card } from '@/components/ui/wideset/card/Card';

export default function CardVariants() {
  return (
    <div className="gap-ws-11 grid w-full grid-cols-[repeat(auto-fit,minmax(16rem,1fr))]">
      {(['bordered', 'flat'] as const).map((variant) => (
        <Card key={variant} variant={variant}>
          <Card.Header>
            <Card.Title>Monthly revenue</Card.Title>
            <Card.Description>Updated every night at 2:00.</Card.Description>
          </Card.Header>
          <Card.Content>
            <p className="typography-body-md text-ws-static-subtle">
              Revenue grew 12% against last month, driven by annual plans.
            </p>
          </Card.Content>
        </Card>
      ))}
    </div>
  );
}

Divider

Cards separate the header from the content by space alone, so a small card reads as one piece. Set divider when the content below the header is heavy, such as a table, a list or a form with a footer of actions: a line then runs under the header and above the footer.

tsx
import { Button } from '@/components/ui/wideset/button/Button';
import { Card } from '@/components/ui/wideset/card/Card';
import { FormField } from '@/components/ui/wideset/form-field/FormField';
import { TextInput } from '@/components/ui/wideset/text-input/TextInput';

export default function CardDivider() {
  return (
    <div className="gap-ws-11 grid w-full grid-cols-[repeat(auto-fit,minmax(16rem,1fr))] items-start">
      <Card>
        <Card.Header>
          <Card.Title>Payment method</Card.Title>
          <Card.Description>Charged on the 1st of every month.</Card.Description>
        </Card.Header>
        <Card.Content>
          <p className="typography-body-md text-ws-static-strong">Visa ending in 4242</p>
          <p className="typography-body-sm text-ws-static-subtle">Expires 08/2028</p>
        </Card.Content>
      </Card>
      <Card divider>
        <Card.Header>
          <Card.Title>Billing contact</Card.Title>
          <Card.Description>Invoices and receipts go to this person.</Card.Description>
        </Card.Header>
        <Card.Content>
          <form
            id="card-billing-form"
            className="gap-ws-11 flex flex-col"
            onSubmit={(event) => event.preventDefault()}
          >
            <FormField label="Full name" htmlFor="card-billing-name">
              <TextInput
                id="card-billing-name"
                placeholder="e.g. Anna Kowalska"
                autoComplete="name"
              />
            </FormField>
            <FormField label="Email address" htmlFor="card-billing-email">
              <TextInput
                id="card-billing-email"
                type="email"
                placeholder="e.g. billing@northwind.co"
                autoComplete="email"
              />
            </FormField>
          </form>
        </Card.Content>
        <Card.Footer className="gap-ws-5 justify-end">
          <Button variant="secondary" preset="border">
            Cancel
          </Button>
          <Button type="submit" form="card-billing-form">
            Save
          </Button>
        </Card.Footer>
      </Card>
    </div>
  );
}

With table

A table goes straight into Card.Content, with no wrapper: the card keeps the width of its column and a table wider than that scrolls horizontally inside it. contentClassName="px-ws-3" adds 4px to the cells' own 16px, so the first column lines up with the title. A table is heavy content, so the card sets divider.

tsx
import { RiDownloadLine } from '@remixicon/react';
import { Card } from '@/components/ui/wideset/card/Card';
import { IconButton } from '@/components/ui/wideset/button/IconButton';
import { StatusBadge } from '@/components/ui/wideset/status-badge/StatusBadge';
import { Table } from '@/components/ui/wideset/table/Table';

const invoices = [
  {
    number: 'INV-2041',
    date: '2 Nov 2026',
    period: 'October 2026',
    amount: '$12,480.00',
    paid: true,
  },
  {
    number: 'INV-2040',
    date: '2 Oct 2026',
    period: 'September 2026',
    amount: '$11,920.00',
    paid: true,
  },
  {
    number: 'INV-2039',
    date: '2 Sep 2026',
    period: 'August 2026',
    amount: '$12,105.00',
    paid: false,
  },
];

export default function CardWithTable() {
  return (
    <div className="grid w-full max-w-[32rem]">
      <Card divider>
        <Card.Header>
          <Card.Title>Invoices</Card.Title>
          <Card.Description>Billed on the 2nd of every month.</Card.Description>
        </Card.Header>
        <Card.Content contentClassName="px-ws-3">
          <Table className="whitespace-nowrap">
            <Table.Head>
              <Table.Row>
                <Table.Header>Number</Table.Header>
                <Table.Header>Date</Table.Header>
                <Table.Header>Period</Table.Header>
                <Table.Header align="right">Amount</Table.Header>
                <Table.Header>Status</Table.Header>
                <Table.Header>
                  <span className="sr-only">Actions</span>
                </Table.Header>
              </Table.Row>
            </Table.Head>
            <Table.Body>
              {invoices.map((invoice) => (
                <Table.Row key={invoice.number}>
                  <Table.Cell>{invoice.number}</Table.Cell>
                  <Table.Cell>{invoice.date}</Table.Cell>
                  <Table.Cell>{invoice.period}</Table.Cell>
                  <Table.Cell align="right">{invoice.amount}</Table.Cell>
                  <Table.Cell>
                    <StatusBadge color={invoice.paid ? 'positive' : 'negative'}>
                      {invoice.paid ? 'Paid' : 'Overdue'}
                    </StatusBadge>
                  </Table.Cell>
                  <Table.Cell align="right">
                    <IconButton
                      aria-label={`Download ${invoice.number}`}
                      icon={RiDownloadLine}
                      preset="ghost"
                      size="sm"
                      variant="secondary"
                    />
                  </Table.Cell>
                </Table.Row>
              ))}
            </Table.Body>
          </Table>
        </Card.Content>
      </Card>
    </div>
  );
}

Media

Card.Media holds its aspect ratio (16/9 unless you pass ratio) before the image loads, so the cards in a grid line up and the page does not jump. In a bordered card it runs to the edges; in a flat one it gets rounded corners. Give the image alt text unless the title already says what it shows.

tsx
import { Card } from '@/components/ui/wideset/card/Card';

const PHOTO =
  'https://images.unsplash.com/photo-1492633423870-43d1cd2775eb?&w=480&h=270&dpr=2&q=80';

export default function CardMedia() {
  return (
    <div className="gap-ws-11 grid w-full grid-cols-[repeat(auto-fit,minmax(16rem,1fr))]">
      {(['bordered', 'flat'] as const).map((variant) => (
        <Card key={variant} variant={variant}>
          <Card.Media>
            <img src={PHOTO} alt="" className="size-full object-cover" />
          </Card.Media>
          <Card.Header>
            <Card.Title>Spring campaign</Card.Title>
            <Card.Description>Portraits for the new landing page.</Card.Description>
          </Card.Header>
        </Card>
      ))}
    </div>
  );
}

API reference

Card

NameDescriptionDefault
children

Card content composed from the available Card subcomponents.

ReactNode
—
className

Additional CSS classes merged with the card root.

string
—
divider

Draws a line under the header and above the footer. Use it when the content below the header is heavy: a table, a list, a form with a footer of actions. Bordered cards only; a flat card has no frame to divide.

boolean
false
variant
'flat''bordered'
'bordered'
Every other prop of <div> is passed through to it. See MDN: <div>.

Card.Action

NameDescriptionDefault
children

Action content aligned with the card header, such as an icon button, badge, or tag.

ReactNode
—
className

Additional CSS classes merged with the action container.

string
—
Every other prop of <div> is passed through to it. See MDN: <div>.

Card.Content

NameDescriptionDefault
children

Card body content rendered inside the scrollable content area.

ReactNode
—
className

Additional CSS classes merged with the scroll container wrapping the content.

string
—
contentClassName

Additional CSS classes merged with the inner content wrapper. Useful for overriding default padding.

string
—
Every other prop of <div> is passed through to it. See MDN: <div>.

Card.Description

NameDescriptionDefault
children

Supporting description shown below the card title.

ReactNode
—
className

Additional CSS classes merged with the description styling.

string
—
Every other prop of <p> is passed through to it. See MDN: <p>.

Card.Footer

NameDescriptionDefault
children

Footer content, usually action buttons or supplementary controls.

ReactNode
—
className

Additional CSS classes merged with the footer styling.

string
—
Every other prop of <div> is passed through to it. See MDN: <div>.

Card.Header

NameDescriptionDefault
children

Header content, usually Card.Title, Card.Description, and optional Card.Action elements.

ReactNode
—
className

Additional CSS classes merged with the header styling.

string
—
Every other prop of <div> is passed through to it. See MDN: <div>.

Card.Media

NameDescriptionDefault
children

Media rendered inside the card, typically an image, illustration, or video.

ReactNode
—
className

Additional CSS classes merged with the media container.

string
—
ratio

Aspect ratio applied to the media container. Accepts CSS ratio strings like `16/9` or numeric values.

string | number
'16/9'
Every other prop of <div> is passed through to it. See MDN: <div>.

Card.Title

NameDescriptionDefault
asChild

Renders onto the child instead of the default `<h3>`, to set the heading level.

boolean
—
children

Card title content.

ReactNode
—
className

Additional CSS classes merged with the title styling.

string
—
Every other prop of <h2> is passed through to it. See MDN: <h2>.

Accessibility

  • Card.Title is an h3 by default. Match the page outline with asChild.
  • Card is a div, not a landmark or a link. Put real links and buttons inside it.
  • Give Card.Media images alt, unless the title already says what the image shows (alt="").
PartRendersDescription
Card<div>A surface grouping related content, media, and actions.
Card.Action<div>An action styled for `Card`.
Card.Content<div>The content surface rendered within `Card`.
Card.Description<p>Supporting descriptive text.
Card.Footer<div>The action area beneath the main content.
Card.Header<div>The header area for a title and supporting content.
Card.Media<div>The media area with a configurable aspect ratio.
Card.Title<h2>The primary title text.

Weekly report

Sent to the team every Monday.

Active

Covers sign-ups, churn and revenue for the last seven days.

tsx
import { Card } from '@/components/ui/wideset/card/Card';
import { StatusBadge } from '@/components/ui/wideset/status-badge/StatusBadge';

<Card>
  <Card.Header>
    <div className="flex items-start justify-between gap-ws-9">
      <div className="flex min-w-0 flex-1 flex-col">
        <Card.Title>Weekly report</Card.Title>
        <Card.Description>Sent to the team every Monday.</Card.Description>
      </div>
      <Card.Action>
        <StatusBadge color="positive">Active</StatusBadge>
      </Card.Action>
    </div>
  </Card.Header>
  <Card.Content>
    <p className="typography-body-md text-ws-static-subtle">Covers sign-ups, churn and revenue for the last seven days.</p>
  </Card.Content>
</Card>

Appearance

Variant
Divider

Content

Header action
Body
Footer