Card
A surface container for grouping related content. Card is a set of composable elements — header, title, description, content, and footer — built on the semantic surface tokens, so it adapts to light and dark themes automatically.
Anatomy
html
| 1 | <nana-card> |
| 2 | <nana-card-header> |
| 3 | <nana-card-title>Project Atlas</nana-card-title> |
| 4 | <nana-card-description>Updated 2 hours ago</nana-card-description> |
| 5 | </nana-card-header> |
| 6 | <nana-card-content> |
| 7 | A shared component library that lets product teams ship faster. |
| 8 | </nana-card-content> |
| 9 | <nana-card-footer> |
| 10 | <nana-button variant="primary" size="sm">Open</nana-button> |
| 11 | <nana-button variant="ghost" size="sm">Dismiss</nana-button> |
| 12 | </nana-card-footer> |
| 13 | </nana-card> |
Variants
Variants describe visual appearance — pick one for the look you need, not the use case.
html
| 1 | <nana-card variant="default">…</nana-card> |
| 2 | <nana-card variant="elevated">…</nana-card> |
| 3 | <nana-card variant="outlined">…</nana-card> |
| 4 | <nana-card variant="filled">…</nana-card> |
Glass
html
| 1 | <!-- Glass works best over imagery or a gradient --> |
| 2 | <nana-card variant="glass">…</nana-card> |
Interactive
interactive
is a modifier that composes with any variant. Pair it with
tabindex="0"
(or wrap the content in a link) so it's keyboard reachable.
html
| 1 | <nana-card variant="elevated" interactive tabindex="0">…</nana-card> |
Content Only
html
| 1 | <nana-card> |
| 2 | <nana-card-content>Even padding on all sides when used alone.</nana-card-content> |
| 3 | </nana-card> |
Customization
Choose a variant
for the look; when you need to match a brand, three CSS variables cover colour and radius.
css
| 1 | /* Pick a variant first; reach for variables only to match a brand. */ |
| 2 | .featured { |
| 3 | --nana-card-bg: #0b1220; |
| 4 | --nana-card-color: #e5edff; |
| 5 | --nana-card-radius: 1rem; |
| 6 | } |
| CSS Variable | Description |
|---|---|
--nana-card-bg | Background colour |
--nana-card-color | Text colour |
--nana-card-radius | Corner radius |
Import
A single import registers every card element.
ts
| 1 | import "@nana-tec/ui-components/card"; |
Elements
| Element | Description |
|---|---|
nana-card | The surface container. Holds variant and interactive. |
nana-card-header | Top section — wraps the title and description. |
nana-card-title | Heading text. |
nana-card-description | Muted supporting text under the title. |
nana-card-content | The main body. |
nana-card-footer | Bottom section — typically actions. |
Props (nana-card)
| Attribute | Type | Default | Description |
|---|---|---|---|
variant | default | elevated | outlined | filled | glass | default | Visual appearance |
interactive | boolean | false | Hover lift + keyboard focus ring for clickable cards |