Documentation

Card

The composed chassis of every card: a media with overlays, a body with a title, a description, stats and a footer.

Web + MobileStableLayout

Web and mobile — the same component for React and React Native. Stable: its API only changes in a major version.

When to use

  • To present one item of a collection: a video, a creator, a guide, a plan.
  • As a link to the item (asChild + interactive): the whole card is one target.
  • To group a few figures under a title (Card.Stat).

When not to use

  • To frame a whole page section: use the page layout, not a card around everything.
  • For a single key figure without a frame.Use instead: Stat
  • For a message about the page.Use instead: Alert

Installation

Install

npm install @krizaka/ui@beta @krizaka/tailwind@beta @krizaka/tokens@beta tailwindcss

Styles

@import "tailwindcss";
@import "@krizaka/tailwind";
@import "@krizaka/ui/tailwind.css";

Import

import { Card } from "@krizaka/ui/card";

Examples

Media card

An image, badges on the media, a title, a description and a footer.

4K
12:04

Night ride across the city

Ten minutes of neon, rain and empty avenues, filmed in one take.

1.2k views2 days ago

Media fallback

No image: the fallback on the accent gradient.

Untitled draft

Processing — the cover arrives with the first frame.

asChild + <a>: the whole card is a link, with the spotlight and the lift.

Stat card

Figures put forward with Card.Stat, tone="elevated".

This month

Revenue

€4,812

Supporters

318

Updated 5 minutes ago

Reveal grid

Cards entering in cascade with reveal and MotionObserver.

Enter

Step 1 of the signature.

Reveal

Step 2 of the signature.

Open

Step 3 of the signature.

Lift

Step 4 of the signature.

Glow

Step 5 of the signature.

Roll

Step 6 of the signature.

Props

CardRoot

PropTypeDefaultDescription
asChildboolean—Renders the child (a link, an article) instead of the <div>, with props, classes and ref merged.
interactiveboolean—The spotlight that follows the pointer and the lift on hover: for a card that is a link.
radius"md" | "lg" | "xl"xlmd · lg · xl.
revealnumber—Enters on scroll (MotionObserver): the index in the grid becomes the delay (50 ms a step, 8 steps at most).
tone"default" | "elevated" | "glass"defaultdefault (the base surface) · elevated (raised, a shadow) · glass (translucent, blurred).

CardMedia

PropTypeDefaultDescription
aspect"video" | "auto" | "square" | "portrait"videoThe ratio of the media: video (16:9) · square · portrait (3:4) · auto (the content's).

CardImage

The image of a media, or its fallback when there is none. alt is empty by default: the title names the card.

PropTypeDefaultDescription
fallbackReactNode—Shown when there is no image: an icon, an illustration (decorative).
srcstring | null—The image's URL; null or nothing shows the fallback.

CardOverlay

What sits on the media (badges, a caption). scrim and fg-on-media are invariant: nothing to do for light.

PropTypeDefaultDescription
corner"top-left" | "top-right" | "bottom-left" | "bottom-right"top-leftThe corner of the media it sits in.

CardBody

PropTypeDefaultDescription
padding"none" | "sm" | "md" | "lg"mdnone · sm · md · lg.

CardTitle

PropTypeDefaultDescription
as"h2" | "h3" | "h4"h3The heading level, to fit the page's outline.

CardStat

A figure put forward: the label in capitals, the value in tabular digits.

PropTypeDefaultDescription
labelrequiredReactNode—What the figure is, in small capitals above it (the figure is the children).

Accessibility

  • Card.Title is a heading (h3 by default, as to change the level) so cards are reachable by heading.
  • A card that is a link is named by its content: keep the title first.
  • The image fallback is decorative and hidden from assistive technology.

Keyboard

KeysAction
Tab / EnterAn asChild link card is one focusable link that Enter follows.

Best practices

  • Build product cards from these parts and override any of them with className — never fork the card.
  • Keep one primary target per card: either the whole card is a link, or it holds buttons — not both.
  • Give Card.Media a fixed aspect so a grid stays aligned while images load.
  • reveal={index} with one MotionObserver per page for the entrance; it is shown at once under reduced motion.

Notes

Anatomy

Card.Root · Card.Media · Card.Image · Card.Overlay · Card.Body · Card.Title · Card.Description · Card.Stat · Card.Footer

  • Card.Root is the frame: tone (default, elevated, glass), radius, and interactive for a card that is a link — the spotlight follows the pointer, the card lifts on hover. With asChild it renders your <a> or <article>.
  • Card.Media holds the image at a fixed aspect (video, square, portrait, auto); Card.Image falls back to fallback when there is no src.
  • Card.Overlay sits on the media in a corner — badges and durations use tone="scrim", identical in both themes.
  • Card.Body carries the title, the description, the stats and the footer.

Products build their own cards from these parts and override any of them through className — never a fork.

Generated from the code of @krizaka/ui 2.0.0-beta.6: its meta.ts, its examples and its types.Edit this documentation on GitHub

On this page