VisorVisor
ComponentsData Display

Card

A compound card component for grouping related content with header, body, and footer sections.

Default

A basic card with header, content, and footer.

Notifications
Manage your notification preferences.

You have 3 unread messages.

Content Only

A simple card with just a content section.

A minimal card with only content — no header or footer.

Small Size

The sm size variant reduces internal padding and gap spacing.

Compact Card
Uses smaller padding.

Ideal for dashboard widgets.

Glass and Editable

variant="glass" draws the card on two layers placed before its content: a glass fill and an edge. Glass is off by default. Inside data-glass="on" (see Glass), the fill turns see-through, blurs the photo behind it and takes the theme's lift, and the edge blends soft-light with the photo. Everywhere else the layers draw the card surface and a plain border, with no blur.

Because the layers are siblings of the content, never its ancestors, a blurred field inside the card (the stepper below) still blurs the photo rather than the card. Keep it that way: put no filter, backdrop-filter, opacity below 1, mask, transform or blend mode on anything between a blurred field and the photo.

editable makes the whole card a button (type="button"). It gets a pen in the top-right corner, and on hover the fill steps up, the shadow deepens and the pen fills with the theme's key colour (--interactive-primary-bg). The card does not move on hover; it presses in slightly while held. Keyboard focus draws an outline in the key colour, and Enter or Space activates it. After a save, set data-flash on the card to play a 1.6s ring in the key colour. To replay it, remove the attribute, force a reflow and set it again. The corner shape comes from the theme's corners.

Friday Night
The field below blurs the photo through the card.

A theme sets the corner, the glass layers, the hover fill and shadow, and the pen's size and inset through the card hooks. Each falls back to the look above. The full list is on Component Tokens.

In Five Looks

The glass card and the editable tile in each look, on the theme picked in the docs. Only the Photo looks turn glass on. Hover the tile, Tab to it, or press Save to see the flash.

Today
Dark
Dark + Photo
Light
Light + Photo

Installation

npx visor add card

This copies two files into your project:

  • components/ui/card/card.tsx — the component
  • components/ui/card/card.module.css — the styles

Usage

import {
  Card, CardHeader, CardTitle, CardDescription,
  CardContent, CardFooter,
} from '@/components/ui/card/card';

<Card>
  <CardHeader>
    <CardTitle>Title</CardTitle>
    <CardDescription>Description text.</CardDescription>
  </CardHeader>
  <CardContent>
    <p>Body content here.</p>
  </CardContent>
  <CardFooter>
    <Button>Action</Button>
  </CardFooter>
</Card>

API Reference

CardProps

PropTypeDefaultDescription
size'default' | 'sm''default'Controls internal padding and gap spacing.
variant'default' | 'glass''default'glass draws a glass fill and a blended edge on sibling layers under data-glass="on", and the card surface and a border elsewhere.
editablebooleanfalseThe whole card is a button, with a pen in the corner and a lift on hover. Set data-flash to play the save flash.
as'div' | 'section' | 'main' | 'button''div' ('button' when editable)The element to render.

The component also accepts all standard HTML attributes of the element it renders (<div> by default, <button> when editable).

Sub-components

ComponentElementPurpose
Card<div>Root container with border and background surface.
CardHeader<div>Top section with grid layout for title and description.
CardTitle<div>Primary heading text.
CardDescription<div>Secondary descriptive text in muted color.
CardContent<div>Main body area with horizontal padding.
CardFooter<div>Bottom section with flex layout for actions.

Accessibility

  • Card is a presentational container — it does not add any ARIA roles by default.
  • Use semantic heading elements inside CardTitle when appropriate for document outline.
  • An editable card is a native <button type="button">: it is in the tab order, Enter and Space activate it, and focus draws an outline in the key colour. Give it an accessible name (aria-label, or text inside). Keep its content to phrasing elements (<span>), and put no other control inside it.
  • The glass layers and the pen are aria-hidden.
  • Under prefers-reduced-motion: reduce the press does not scale and colour changes are instant.
  • Interactive cards that navigate should wrap the entire card in an anchor.