Card
Displays a container with header, content, and footer.
Installation
pnpm dlx cubix@latest add card --base radixUsage
import {
Card,
CardAction,
CardContent,
CardDescription,
CardFooter,
CardHeader,
CardTitle,
} from "@/components/cubix/card"<Card>
<CardHeader>
<CardTitle>Card title</CardTitle>
<CardDescription>Card description</CardDescription>
</CardHeader>
<CardContent>...</CardContent>
<CardFooter>...</CardFooter>
</Card>Examples
With form
Cards pair naturally with Inputs and Buttons to build forms:
With action
Use CardAction to add an action element (like a button) in the top-right corner of the header:
With icon
Compose the header with any element - an icon bubble draws attention to the title:
API Reference
Note: Every part renders a data-slot attribute (card, card-header, ...) for targeting in tests and parent selectors.
Card
The Card component displays a container with header, content, and footer.
| Prop | Type | Default | Description |
|---|---|---|---|
| className | string | - | Additional Tailwind classes merged with the component styles (last one wins). |
| ...props | React.ComponentProps<'div'> | - | All native div attributes (role, id, aria-*, ...) are forwarded to the rendered element. |
CardHeader
Displays the card header. When a CardAction is present it switches to a two-column grid automatically.
| Prop | Type | Default | Description |
|---|---|---|---|
| className | string | - | Additional Tailwind classes merged with the component styles (last one wins). |
CardTitle
Displays the title of the card.
| Prop | Type | Default | Description |
|---|---|---|---|
| className | string | - | Additional Tailwind classes merged with the component styles (last one wins). |
CardDescription
Displays the description or content of the card header.
| Prop | Type | Default | Description |
|---|---|---|---|
| className | string | - | Additional Tailwind classes merged with the component styles (last one wins). |
CardAction
Displays an action element (like a button) positioned in the top-right corner of the header.
| Prop | Type | Default | Description |
|---|---|---|---|
| className | string | - | Additional Tailwind classes merged with the component styles (last one wins). |
CardContent
Displays the main content of the card.
| Prop | Type | Default | Description |
|---|---|---|---|
| className | string | - | Additional Tailwind classes merged with the component styles (last one wins). |
CardFooter
Displays the footer of the card - ideal for actions.
| Prop | Type | Default | Description |
|---|---|---|---|
| className | string | - | Additional Tailwind classes merged with the component styles (last one wins). |