docs/developer_docs/components/ui/card.mdx
import { StoryWithControls } from '../../../src/components/StorybookWrapper';
A container component for grouping related content. Supports titles, borders, loading states, and hover effects.
<StoryWithControls component="Card" props={{ padded: true, title: "Dashboard Overview", children: "This card displays a summary of your dashboard metrics and recent activity.", bordered: true, loading: false, hoverable: false }} controls={[ { name: "padded", label: "Padded", type: "boolean", description: "Whether the card content has padding." }, { name: "title", label: "Title", type: "text", description: "Title text displayed at the top of the card." }, { name: "children", label: "Children", type: "text", description: "The content inside the card." }, { name: "bordered", label: "Bordered", type: "boolean", description: "Whether to show a border around the card." }, { name: "loading", label: "Loading", type: "boolean", description: "Whether to show a loading skeleton." }, { name: "hoverable", label: "Hoverable", type: "boolean", description: "Whether the card lifts on hover." } ]} />
Edit the code below to experiment with the component:
function Demo() {
return (
<Card title="Dashboard Overview" bordered>
This card displays a summary of your dashboard metrics and recent activity.
</Card>
);
}
function CardStates() {
return (
<div style={{ display: 'flex', gap: 16, flexWrap: 'wrap' }}>
<Card title="Default" bordered style={{ width: 250 }}>
Default card content.
</Card>
<Card title="Hoverable" bordered hoverable style={{ width: 250 }}>
Hover over this card.
</Card>
<Card title="Loading" bordered loading style={{ width: 250 }}>
This content is hidden while loading.
</Card>
<Card title="No Border" style={{ width: 250 }}>
Borderless card.
</Card>
</div>
);
}
| Prop | Type | Default | Description |
|---|---|---|---|
padded | boolean | true | Whether the card content has padding. |
title | string | "Dashboard Overview" | Title text displayed at the top of the card. |
children | string | "This card displays a summary of your dashboard metrics and recent activity." | The content inside the card. |
bordered | boolean | true | Whether to show a border around the card. |
loading | boolean | false | Whether to show a loading skeleton. |
hoverable | boolean | false | Whether the card lifts on hover. |
import { Card } from '@superset/components';
:::tip[Improve this page] This documentation is auto-generated from the component's Storybook story. Help improve it by editing the story file. :::