import { Card, CardMedia, ActionableCard } from "@brijbyte/md3-react/card";
@import "@brijbyte/md3-react/ripple.css"; /* For ActionableCard */
@import "@brijbyte/md3-react/card.css";
Pick elevated (the default), filled, or outlined and get the right shadow, fill, and border for free. The card itself stays a bare container — a flex column with no padding — so you control layout and spacing instead of fighting preset ones.
Rests at level 1 on a low surface container.
Flat, on the highest surface container.
Flat surface with an outline-variant border.
A card's contents vary too much for a fixed set of sub-components to cover
without getting in the way, so there's no CardHeader / CardContent /
CardFooter — MD3 treats card anatomy as guidance, not API. Compose it from
Typography, buttons, and your
own markup. The
spec's numbered anatomy
maps directly:
Card, with variant picking elevated / filled / outlinedCardMediaButton, right-aligned in a padded rowTypography body-medium in on-surface-variantTypography, e.g. body-medium or title-mediumTypography, e.g. title-largeEdge-to-edge images need clipping and corner-rounding that the card itself
skips, so that work lives in CardMedia instead: it clips its content and
rounds whichever corners touch the card's edge — the top pair as the first
child, the bottom pair as the last. A child <img> or <video> fills it
edge-to-edge with object-fit: cover.
12 km · moderate · open year-round
A steady climb through larch forest to a ridge with views over both valleys. Best light in the early morning.
When the whole card should be clickable, ActionableCard gets you there
without hand-rolling hover, focus, and press states — the same three
variants, plus the spec's interaction states: a state layer with ripple, an
elevation raise on hover, the focus ring (outlined cards also flip their
border to on-surface), and disabled. By default it renders a div with
role="button" and keyboard activation, not a native <button>, since cards
often need headings and other content a <button> can't legally contain.
Pass render (e.g. <a href>) to navigate instead.
Keep a card's primary action singular — nested buttons inside it would fire
their own click and the card's at once. For drag interactions, style off a
data-dragged attribute you set from your own drag state.
Hover, focus, and press me.
Hover, focus, and press me.
Hover, focus, and press me.
Not interactive.