Card
Card groups related content with optional cover, header, footer, and actions.
Demos
Basic
Use
title for a simple header, or put custom markup in the header slot. Cover
Set
cover to an image URL for a built-in top image, or provide a cover slot (slot wins when present). Cover images use object-fit: cover with a max height. cover attribute.
Cover from the cover slot (wins over cover attribute). Size
Density via
sm, md (default), and lg. Hoverable
Enable
hoverable for a soft shadow and slight translate on hover. Segmented
segmented adds dividers between header, content, and footer when those regions exist. Footer region
Closable
closable dispatches bubbling gk-close; the card does not hide itself. Here the host hides the card and shows a closable gk-alert. API
Card Props
| Prop | Type | Default |
|---|---|---|
title | string | — |
size | 'sm' | 'md' | 'lg' | 'md' |
cover | string | — |
hoverable | boolean | false |
bordered | boolean | true |
segmented | boolean | false |
closable | boolean | false |
Card Slots
| Name | Description |
|---|---|
cover | Custom cover (wins over cover attribute) |
header | Custom header (wins over title attribute) |
| default | Main content |
footer | Footer region |
action | Top-right actions (beside close when both present) |
Card Events
| Name | Description |
|---|---|
gk-close | Close button activated; bubbles; composed: true |
CSS Parts
| Part | Description |
|---|---|
base | Outer article surface |
cover | Cover region |
header | Header row |
content | Main content wrapper |
footer | Footer region |
action | Action area (slot + close) |
close | Close button |