Skip to content
Pebble Pro is here at $49 one timeSee what’s included ↗
Pebble
ComponentsDocsMCPPricing
⌕ Find a component↗Log in
All components 673

Categories

Core inputs & forms46Buttons & actions33Navigation36Overlays & feedback49Data display33Charts & data viz40Cards & layout43Marketing blocks38App shells & pages37AI interfaces40Text & typography effects33Backgrounds & visual effects38Motion & transitions32Numbers & counters32Media34E-commerce333D & interactive36Themed sets40
Start with the essentials.Installation guide ↗Connect your agent ↗
← All componentsCards & layout

Card

A bordered surface with header, title, description, corner action, content and footer slots.

Preview

Sign-ups
Last 14 days
Live
5,724+8.2%
Today 538Updated 3 min ago
New
Stoneware pour-over
Kiln batch 14 · Ash glaze
$48.00
23 in stockShips Tuesday
Spring field survey
Due Friday · 4 contributors
IAMKPRTS
31 of 40 sites
survey sync --site north-ridge
✓ 214 samples uploaded

No archived reports

Reports older than 90 days land here.

Install

Add the editable source with the shadcn CLI. Your project also needs the shared theme tokens this component uses. Setup and requirements. The Pebble installer is not published yet.

npx shadcn@latest add https://pebbleui.com/r/card.json

Props

PropTypeDefaultDescription
variant"raised" | "flat" | "well""raised"Card: raised has a ring and layered shadow, flat drops the shadow, well is a recessed tray.
Card / CardHeader / CardTitle / CardDescription / CardAction / CardContent / CardFooterReact.ComponentProps<"div">-Each part is a div; all native attributes pass through.
CardMediaReact.ComponentProps<"div">-Inset, rounded media tray for an image or video; sits flush to the card top when first.
CardLinkReact.ComponentProps<"a">-Makes the whole card clickable: its hit area covers the card, which lifts on hover and shows focus.
classNamestring-Merged last on every part, so it wins over the defaults.
Build notes
Plain `div`s with `data-slot` names and `cn()` class merging; no primitive.
The surface uses the `card`/`card-foreground` tokens with a `border` edge,
`rounded-xl` (radius token + 4 px) and `shadow-sm`, and gets its vertical
padding (`py-6`) on the root while each section carries its own horizontal
`px-6`, so sections can go full-bleed by overriding one class. The header is a
CSS grid with `grid-rows-[auto_auto]`; the selector
`has-[[data-slot=card-action]]:grid-cols-[1fr_auto]` adds a right column only
when an action is present, and the action sits at `col-start-2 row-span-2
row-start-1`, aligned top-right. `[.border-b]:pb-6` on the header and
`[.border-t]:pt-6` on the footer add spacing only when the author adds a
divider border. Differences from the source: explicit `border-border`, tighter
header gap (`gap-1.5`), `leading-snug` title so multi-line titles stay
readable, a `gap-2` footer for button rows, and the header's container-query
name is dropped.

**Pebble (2026-11-03).** The border is gone: the raised surface is `bg-card
ring-1 ring-hairline shadow-raised-md inset-shadow-highlight`, with `flat` and
`well` (`bg-muted inset-shadow-xs`) variants keyed off `data-variant`. Spacing
is compact: `py-5`/`px-5`, `gap-5`, a 15 px semibold title with
`-0.01em` tracking, 13 px description and footer, `pt-4` after a footer
divider. `CardMedia` is a `mx-1.5` inset tray (`rounded-md bg-muted ring-1
ring-hairline`, `first:-mt-3.5` so it hugs the top edge). `CardLink` makes the
card clickable with a stretched `after:absolute after:inset-0` pseudo-element;
the root reads it with `has-[[data-slot=card-link]]` for the hover lift and
press, and `has-[[data-slot=card-link]:focus-visible]` to draw the focus
ring round the card, so Card stays a server component with no Slot. The demo
shows a live metric with a mini bar chart, a product card with a drawn SVG
thumbnail, a flat progress card with an avatar stack and code snippet, and a
well empty state.

<!-- PEBBLE-LICENSE -->
View source

registry/card/card/card.tsx

/* PEBBLE-LICENSE
Built by Pebble. Component: card.

First-party license: MIT

The following first-party terms apply only to original Pebble material.

MIT License

Copyright (c) 2026 Praxys Solutions LLC (Pebble)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

THIRD-PARTY NOTICES
These notices apply to identified upstream portions; Pebble terms do not replace or narrow their rights.

Upstream: https://raw.githubusercontent.com/shadcn-ui/ui/main/LICENSE.md
MIT License

Copyright (c) 2023 shadcn

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
END PEBBLE-LICENSE */

import * as React from "react";

import { cn } from "@/lib/utils";

// Pebble: a card is an object on the desk. Raised = hairline ring + layered
// shadow + 1 px top light. Flat drops the shadow for dense grids; well is a
// recessed tray for secondary or empty content.
const variants = {
  raised: "bg-card ring-1 ring-hairline shadow-raised-md inset-shadow-highlight",
  flat: "bg-card ring-1 ring-hairline",
  well: "bg-muted ring-1 ring-hairline inset-shadow-xs",
} as const;

export type CardProps = React.ComponentProps<"div"> & {
  variant?: keyof typeof variants;
};

export function Card({ variant = "raised", className, ...props }: CardProps) {
  return (
    <div
      data-slot="card"
      data-variant={variant}
      className={cn(
        "relative flex flex-col gap-5 rounded-xl py-5 text-card-foreground",
        variants[variant],
        // A card holding a CardLink is clickable as a whole: hover lifts it one
        // step, press settles it, and the link's focus shows on the card.
        "motion-safe:transition-[translate,scale,box-shadow] motion-safe:duration-(--motion-base) motion-safe:ease-enter",
        "has-[[data-slot=card-link]]:hover:shadow-raised-lg has-[[data-slot=card-link]]:motion-safe:hover:-translate-y-0.5",
        "has-[[data-slot=card-link]]:active:shadow-raised-sm has-[[data-slot=card-link]]:motion-safe:active:translate-y-0 has-[[data-slot=card-link]]:motion-safe:active:scale-[0.99]",
        "has-[[data-slot=card-link]:focus-visible]:ring-2 has-[[data-slot=card-link]:focus-visible]:ring-ring has-[[data-slot=card-link]:focus-visible]:ring-offset-2 has-[[data-slot=card-link]:focus-visible]:ring-offset-background",
        // Rings are box-shadows, which forced colors drops: outline the card instead.
        "forced-colors:has-[[data-slot=card-link]:focus-visible]:outline-2 forced-colors:has-[[data-slot=card-link]:focus-visible]:outline-offset-2 forced-colors:has-[[data-slot=card-link]:focus-visible]:outline-[Highlight] forced-colors:has-[[data-slot=card-link]:focus-visible]:outline-solid",
        className,
      )}
      {...props}
    />
  );
}

export function CardMedia({ className, ...props }: React.ComponentProps<"div">) {
  return (
    <div
      data-slot="card-media"
      className={cn(
        // Inset 6 px from the card edge with the nested radius (xl − 6 px), so
        // the media reads as a tray set into the card, not a sticker on it.
        "relative mx-1.5 overflow-hidden rounded-md bg-muted ring-1 ring-hairline first:-mt-3.5",
        className,
      )}
      {...props}
    />
  );
}

export function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
  return (
    <div
      data-slot="card-header"
      className={cn(
        // Two rows (title, description). When an action is present a second
        // column opens on the right and the action spans both rows.
        "grid auto-rows-min grid-rows-[auto_auto] items-start gap-1 px-5",
        "has-[[data-slot=card-action]]:grid-cols-[1fr_auto]",
        // A header given a bottom border gets matching space under it.
        "[.border-b]:pb-5",
        className,
      )}
      {...props}
    />
  );
}

export function CardTitle({ className, ...props }: React.ComponentProps<"div">) {
  return (
    <div
      data-slot="card-title"
      className={cn("text-[15px] leading-snug font-semibold tracking-[-0.01em]", className)}
      {...props}
    />
  );
}

export function CardDescription({ className, ...props }: React.ComponentProps<"div">) {
  return (
    <div
      data-slot="card-description"
      className={cn("text-[13px] text-muted-foreground", className)}
      {...props}
    />
  );
}

export function CardAction({ className, ...props }: React.ComponentProps<"div">) {
  return (
    <div
      data-slot="card-action"
      className={cn("col-start-2 row-span-2 row-start-1 self-start justify-self-end", className)}
      {...props}
    />
  );
}

export function CardContent({ className, ...props }: React.ComponentProps<"div">) {
  return <div data-slot="card-content" className={cn("px-5", className)} {...props} />;
}

export function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
  return (
    <div
      data-slot="card-footer"
      className={cn(
        "flex items-center gap-2 px-5 text-[13px] [.border-t]:border-border [.border-t]:pt-4",
        className,
      )}
      {...props}
    />
  );
}

/**
 * Makes the whole card clickable without wrapping it in an anchor: the link's
 * hit area is stretched over the card with a pseudo-element, its text stays
 * the accessible name, and the card shows hover, press and focus for it.
 */
export function CardLink({ className, ...props }: React.ComponentProps<"a">) {
  return (
    <a
      data-slot="card-link"
      className={cn(
        "outline-none after:absolute after:inset-0 after:z-10 after:rounded-[inherit] after:content-['']",
        className,
      )}
      {...props}
    />
  );
}
Pebble

Small details.
Better interfaces.

React components to explore, make your own, and build on.

Library

  • Components
  • Installation
  • Pricing

Resources

  • For agents
  • About
  • Support

Legal

  • License
  • Terms
  • Privacy
  • Final sale

Built by Pebble

A product of Praxys Solutions LLC ↗

Pebble Pro is live

$49 one time, lifetime updates ↗