Card
Container for one topic with header, content, and footer.
Getting started
Install the theme and register the plugin.
Outlined
Interactive cards react to hover and press.
Import
Section titled “Import”import { Card, CardHeader, CardHeaderMain, CardTitle, CardDescription, CardAction, CardContent, CardFooter,} from "@pelagornis/page/components";Example
Section titled “Example”The preview above renders this file. Copy it into src/components/ to start from it.
import { Badge, Button, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardHeaderMain, CardTitle, Grid, Text,} from "@pelagornis/page/components";
export default function CardDemo() { return ( <Grid minItem="foundationSize2560" gap="sizeMedium" className="w-full"> <Card> <CardHeader> <CardHeaderMain> <CardTitle>Getting started</CardTitle> <CardDescription>Install the theme and register the plugin.</CardDescription> </CardHeaderMain> <CardAction> <Badge variant="success">5 min</Badge> </CardAction> </CardHeader> <CardContent> <Text variant="bodySm">Header, sidebar, search, and footer come from RefineUI.</Text> </CardContent> <CardFooter> <Button variant="primary" size="sm"> Read guide </Button> </CardFooter> </Card> <Card variant="outlined" interactive> <CardHeader> <CardTitle>Outlined</CardTitle> <CardDescription>Interactive cards react to hover and press.</CardDescription> </CardHeader> </Card> </Grid> );}Use in MDX
Section titled “Use in MDX”Card is composed from parts that share React state. Children written in MDX are rendered as separate islands, so the parts can’t reach each other. Put the composition in a .tsx file, like the example above, and import that file instead.
---title: Example---
import CardExample from "../../components/CardExample";
<CardExample client:load />client:load hydrates the island on page load. Use client:visible for content far down the page.
Use in Markdoc
Section titled “Use in Markdoc”Markdoc tags render Astro components, and this one needs client state. Wrap the example in an .astro file that hydrates it, then register that file as a tag.
---import CardExample from "../CardExample";---
<CardExample client:load />import { component, defineMarkdocConfig } from "@astrojs/markdoc/config";import starlightMarkdoc from "@astrojs/starlight-markdoc";import pageMarkdoc from "@pelagornis/page/markdoc";
export default defineMarkdocConfig({ extends: [starlightMarkdoc(), pageMarkdoc()], tags: { "card-example": { render: component("./src/components/markdoc/CardExample.astro"), selfClosing: true, }, },});{% card-example /%}Variants
Section titled “Variants”Values the component accepts for each variant prop.
| Prop | Values |
|---|---|
variant | elevated outlined |
Anatomy
Section titled “Anatomy”Parts of the component and the data-refineui role each one renders.
| Part | Role |
|---|---|
root | card |
action | card-action |
content | card-content |
description | card-description |
footer | card-footer |
header | card-header |
header_main | card-header-main |
title | card-title |
States
Section titled “States”States the component styles. Component states are exposed as data attributes.
| Kind | States |
|---|---|
| data-state | default hover pressed disabled |
Reference
Section titled “Reference”- RefineUI · Card for design guidance and token detail.
- Use in MDX and Use in Markdoc for the general rules.