Data display
ContentCard
Card with an optional cover image, title, description and caption; optionally a button or link.
import { ContentCard } from "datui";Playground
Card titleDescriptionCaption
<ContentCard title="Card title" description="Description" caption="Caption" variant="shadow" />Examples
Content cards
No imageA static card with text only.Today
Accessibility
- With
hrefrenders<a>, withonClicka<button>, otherwise a<div>. - Image
altdefaults to""because the card text usually describes it. disabledblocks activation.
API
ContentCard
Card with an optional cover image and text. With `onClick`/`href` the whole card is a button/link.
| Prop | Type | Default | Description |
|---|---|---|---|
| activated | boolean | — | Keep the pressed look, e.g. for the active item of a list. |
| alt | string | Image alt text. Empty by default: the card's text usually describes it. | |
| as | ElementType<any, keyof IntrinsicElements> | — | Element to render. Defaults to `a` with `href`, `button` with `onClick`, otherwise `div`. |
| caption | ReactNode | — | |
| className | string | — | |
| crossOrigin | CrossOrigin | — | |
| description | ReactNode | — | |
| disabled | boolean | — | |
| href | string | — | |
| imageObjectFit | ObjectFit | cover | |
| loading | "eager" | "lazy" | — | |
| maxHeight | number | — | Image max height in px. |
| overTitle | ReactNode | — | |
| referrerPolicy | HTMLAttributeReferrerPolicy | — | |
| rel | string | — | |
| sizes | string | — | |
| src | string | — | |
| srcSet | string | — | |
| target | string | — | |
| title | ReactNode | — | |
| titleAs | ElementType<any, keyof IntrinsicElements> | span | |
| type | "button" | "submit" | "reset" | — | |
| variant | "shadow" | "tint" | "outline" | "outline-tint" | "plain" | shadow | Card surface. |