Skip to content
Page

Card

Container for one topic with header, content, and footer.

Getting started

Install the theme and register the plugin.

5 min
Header, sidebar, search, and footer come from RefineUI.

Outlined

Interactive cards react to hover and press.

import {
Card,
CardHeader,
CardHeaderMain,
CardTitle,
CardDescription,
CardAction,
CardContent,
CardFooter,
} from "@pelagornis/page/components";

The preview above renders this file. Copy it into src/components/ to start from it.

src/components/CardExample.tsx
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>
);
}

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.

src/content/docs/example.mdx
---
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.

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.

src/components/markdoc/CardExample.astro
---
import CardExample from "../CardExample";
---
<CardExample client:load />
markdoc.config.mjs
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,
},
},
});
src/content/docs/example.mdoc
{% card-example /%}

Values the component accepts for each variant prop.

PropValues
variantelevated outlined

Parts of the component and the data-refineui role each one renders.

PartRole
rootcard
actioncard-action
contentcard-content
descriptioncard-description
footercard-footer
headercard-header
header_maincard-header-main
titlecard-title

States the component styles. Component states are exposed as data attributes.

KindStates
data-statedefault hover pressed disabled