Skip to content

Components

Card

Groups related content with a header, body and footer.

Customize
Ombelle · light

Installation

Run in a project initialized with an Ombelle preset (see Get started). The component uses the saved project preset. Run the command from your app folder; it shows the changes and asks before writing.

pnpm dlx @ombelle-ui/cli@1.1.2 add card

Adds components/ui/card.tsx and installs react, clsx, tailwind-merge with lifecycle scripts disabled.

In a liquid glass project the plan adds a notice that accessibility is not guaranteed, because text contrast depends on the background behind the glass.

Usage

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

export function ProjectSummary() {
  return (
    <Card density="dense">
      <CardHeader>
        <CardTitle level={2}>Website refresh</CardTitle>
        <CardDescription>Design work for the next release.</CardDescription>
      </CardHeader>
      <CardContent><p>Three milestones remain.</p></CardContent>
      <CardFooter>Updated today</CardFooter>
    </Card>
  )
}

export function Surfaces() {
  return (
    <>
      <Card appearance="outlined"><CardHeader><CardTitle>Outlined card</CardTitle></CardHeader><CardContent>Project summary.</CardContent></Card>
      <Card appearance="subtle"><CardHeader><CardTitle>Subtle card</CardTitle></CardHeader><CardContent>Recent activity.</CardContent></Card>
    </>
  )
}

API and states

API
Card (density: default, dense; appearance: default, outlined, subtle), CardHeader, CardAction, CardTitle (level), CardDescription, CardContent, CardFooter, CardLink, CardMedia, CardGroup (name, value, defaultValue, onValueChange), CardOption (value, title, description, disabled)
Minimum states
Default, dense, outlined, subtle; link card with hover lift; option selected, focused and disabled; media header
Native basis
<section> or <div> with deliberate headings
Styles
Stable in Ombelle, Papier, Organic, Retro futurism, minimalist, neo-brutalism and flat, light and dark. Liquid glass: stable, accessibility not guaranteed.