Card
A contained surface for grouping related content with configurable elevation and padding.
Overview
Card is a flexible container that groups related content within a visually distinct surface. Three variants cover common elevation patterns — use
elevated for floating content, outlined for bordered sections, and filled for subtle background grouping.- Use
elevatedfor primary content cards that need visual prominence. - Use
outlinedwhen a clear boundary is needed without adding depth. - Use
filledfor secondary areas or nested content regions. - Adjust
paddingto match the density requirements of the content inside.
Accessibility
- Card renders as a
<div>with no implicit role. Add semantic structure to its content (headings, lists) to aid navigation. - If a card acts as a clickable region, use a
<button>or<a>inside rather than attaching click handlers to the card itself.
Import
import { Card } from "@cocso-ui/react";Default
A card with default elevated style and medium padding.
Card Title
This is a card with default elevated style and medium padding.
Variant
Three visual variants adjust the elevation and border style.
API Reference
Card
| Prop | Type | Default | Description |
|---|---|---|---|
variant | "elevated" | "outlined" | "filled" | "elevated" | Controls the visual style of the card. `elevated` adds a shadow, `outlined` adds a border, `filled` uses a background color. |
padding | "sm" | "md" | "lg" | "md" | Controls the internal padding. Adjust based on content density. |
children* | ReactNode | - | The content rendered inside the card. |