Card
Card groups related content and actions in a flexible surface. It is a
Takeoff-owned wrapper with compound parts for consistent spacing, typography,
and theming.
Usage
import { Card } from '@takeoff-ui/react-spar';
<Card>
<Card.Header>
<Card.Title />
</Card.Header>
<Card.Body>
<Card.Description />
</Card.Body>
<Card.Footer />
</Card>
Playground
Header Type
Footer Type
API Reference
Card
Data attributes
| Attribute | Applied when | Purpose |
|---|---|---|
| data-slot="root" | Always | Stable selector for wrapper styling on the root slot. |
Card.Header
Props
| Name | Type | Default | Description |
|---|---|---|---|
| headerType | CardHeaderType | 'basic' | Type of the header. |
| classNames | Partial<Record<"root", string>> | - | Per-slot extra classes. |
| slotProps | Partial<Record<"root", React.HTMLAttributes<HTMLElement>>> | - | Per-slot HTML-attribute overrides. |
Data attributes
| Attribute | Applied when | Purpose |
|---|---|---|
| data-slot="root" | Always | Stable selector for wrapper styling on the root slot. |
| data-header-type | Always | Reflects the resolved headerType prop. |
Card.Title
Props
| Name | Type | Default | Description |
|---|---|---|---|
| level | 1 | 2 | 3 | 4 | 5 | 6 | 5 | Semantic heading level used when as is not provided. |
| classNames | Partial<Record<"root", string>> | - | Per-slot extra classes. |
| slotProps | Partial<Record<"root", React.HTMLAttributes<HTMLElement>>> | - | Per-slot HTML-attribute overrides. |
Data attributes
| Attribute | Applied when | Purpose |
|---|---|---|
| data-slot="root" | Always | Stable selector for wrapper styling on the root slot. |
| data-level | When as is not set | Reflects the level prop that drives the rendered heading element. |
Card.Description
Data attributes
| Attribute | Applied when | Purpose |
|---|---|---|
| data-slot="root" | Always | Stable selector for wrapper styling on the root slot. |
Card.Body
Data attributes
| Attribute | Applied when | Purpose |
|---|---|---|
| data-slot="root" | Always | Stable selector for wrapper styling on the root slot. |
Card.Footer
Props
| Name | Type | Default | Description |
|---|---|---|---|
| footerType | CardFooterType | 'basic' | Type of the footer. |
| classNames | Partial<Record<"root", string>> | - | Per-slot extra classes. |
| slotProps | Partial<Record<"root", React.HTMLAttributes<HTMLElement>>> | - | Per-slot HTML-attribute overrides. |
Data attributes
| Attribute | Applied when | Purpose |
|---|---|---|
| data-slot="root" | Always | Stable selector for wrapper styling on the root slot. |
| data-footer-type | Always | Reflects the resolved footerType prop. |
Type Definitions
| Name | Definition |
|---|---|
| CardHeaderType | 'basic' | 'divided' | 'light' | 'dark' | 'primary' |
'basic' | 'divided' | 'light' |