Card

<Card>TailwindCSS Modules

A highly composable surface container that groups related content and actions together.

InstallationColoxo CLI
npx coloxo add card --style coloxo-css
ES Module ImportPlayground / npm package
import { Card, CardHeader, CardContent, CardMedia, CardActions, CardActionArea } from '@coloxo/ui';

Design Tokens:

--cx-bg-primary: #FFFFFF--cx-border-secondary: #CBD5E1--cx-radius-xl: 12pxshadow: sm

1. Variant Matrix

Cards come in outline (default), elevated, flat, and many more surface styles.

VariantOutlineElevatedFlat
Variants
Outline
Default bordered card.
Content inside.
Elevated
Card with soft elevation.
Content inside.
Flat
Solid background, no border.
Content inside.

2. Interactive Props Configurator

Visual Render Canvas
Quick Title
Simple description for the basic API.
Content goes here.
tsx
<Card  title="Quick Title"  description="Simple description for the basic API.">  Content goes here.</Card>

3. Dark theme

Cards adapt border colors and shadows automatically.

Dark Mode Card
Outline variant.
Notice the subtle border and deep background.

4. Enterprise layout compositions

Cards can be nested and laid out in responsive grids.

+12.4%

1,248

Total Likes

-2.1%

84

Dislikes

Accessibility

CardActionArea

When using CardActionArea, the root element renders as a <button> (or <a> if href is passed). It automatically handles Space/Enter keys and shows focus outlines.

Image Alt Text

When using CardMedia as an <img>, always provide an `alt` prop. If using it as a background image div, provide a `title` or `aria-label`.

Props

NameTypeDefaultDescription
variantCardVariantoutlineVisual surface style. Import CARD_VARIANTS for the full catalog.
padding"none" | "sm" | "md" | "lg"mdBody padding when using the simple title/footer API.
titleReactNode—Simple API heading.
descriptionReactNode—Simple API supporting text under title.
headerReactNode—Custom header slot (replaces title/description).
footerReactNode—Footer slot for actions or meta.
childrenReactNode—Body content, or compound slots when not using simple API.
CardHeader.titleReactNode—Header title.
CardHeader.subheaderReactNode—Supporting text under title.
CardHeader.avatarReactNode—Leading avatar.
CardHeader.actionReactNode—Trailing header action.
CardHeader.disableTypographybooleanfalseSkip default title/subheader wrappers.
CardContent.padding"none" | "sm" | "md" | "lg"mdContent padding.
CardContent.componentElementTypedivPolymorphic root element.
CardMedia.imagestring—Background image URL (div surface) or img src.
CardMedia.srcstring—Alias for image on media elements.
CardMedia.componentElementTypedivdiv | img | video | audio | iframe | picture.
CardMedia.heightnumber | string—Media height (px when number).
CardMedia.altstring—Accessible name for the media.
CardMedia.titlestring—Title / fallback accessible name.
CardActions.disableSpacingbooleanfalseRemove default action spacing.
CardActionArea.onClick() => void—Primary click handler.
CardActionArea.hrefstring—Renders as an anchor when set.
CardActionArea.activeboolean—Forces data-active styles.
CardActionArea.disabledboolean—Disables interaction.
CardActionArea.componentElementType—Polymorphic root (button/a/custom).
CARD_VARIANTScatalog—Exported style metadata for docs and galleries.