chrome
<tc-card>
Surface container with optional title/subtitle and named slots for media, header, and footer.
import
"@ra9/tan-compose-kit/card"
Props
| Name | Type | Default | Description |
|---|---|---|---|
title | string | "" | Header title text. Used by the default header slot when no `header` slot is provided. |
subtitle | string | "" | Header subtitle text shown below the title. |
padded | boolean | true | Whether to apply internal padding. Set to false for full-bleed layouts. |
bordered | boolean | true | Outline border around the card. |
elevated | boolean | false | Apply a soft drop shadow. |
Slots
| Slot | Description |
|---|---|
media | Image or visual at the top, rendered full-bleed (no padding). |
header | Custom header content; overrides the title/subtitle props when provided. |
(default) | Body content. |
footer | Bottom bar — typically action buttons. Renders a divider above when present. |
CSS variables
| Variable | Default | Description |
|---|---|---|
--tc-card-surface | var(--tc-color-surface, #ffffff) | Card background. |
--tc-card-ink | var(--tc-color-ink, #14171f) | Body text color. |
--tc-card-soft | var(--tc-color-ink-soft, #5a6072) | Subtitle color. |
--tc-card-rule | var(--tc-color-rule, #ece5d3) | Border + divider color. |
--tc-card-radius | var(--tc-radius-lg, 12px) | Corner radius. |
--tc-card-shadow | var(--tc-shadow-md, …) | Shadow when `elevated`. |
--tc-card-font | var(--tc-font-sans, …) | Font family. |
--tc-card-padding-x | var(--tc-space-5, 20px) | Horizontal padding. |
--tc-card-padding-y | var(--tc-space-5, 20px) | Vertical padding. |
--tc-card-gap | var(--tc-space-3, 12px) | Internal spacing between header / body / footer. |
Examples
Basic usage
With actions
Use the footer slot for action buttons. The card automatically draws a divider above the footer when slotted content is present.
Custom header
Replace the default title/subtitle with your own layout using the header slot.
Media
The media slot is full-bleed — no horizontal padding.
Variants
Theming
Accessibility
- The card itself is a
<div>— no inherent role. If your card is the only target for a click, wrap it in a real link or button. - The title is plain text, not a heading. If your card needs to land in a document outline, drop a real
<h2>/<h3>into theheaderslot instead. - The media slot does not auto-add
alttext — the caller is responsible for accessible images.