A versatile card component for grouping related content. Card uses the Panel core component as its surface layer, supporting the same theming system — feedback colors, background styles, border, and radius control — while adding a structured layout with optional header (heading, subheading, leading, trailing), a content area, and an optional footer.
A brief description of the card content
Card body content goes here. This is the main content area of the card.
With shadow and hover effect
An elevated card with interactive hover state.
---
import Card from "../Card.astro";
import { stack } from "@pindoba/styled-system/patterns";
import { css } from "@pindoba/styled-system/css";
---
<div class={stack({ gap: "md", direction: "column", width: "100%" })}>
<Card
header={{
heading: "Card Title",
subheading: "A brief description of the card content",
}}
footer={{
leading: "Footer info",
trailing: "Action",
}}
>
<p class={css({ margin: "0" })}>
Card body content goes here. This is the main content area of the card.
</p>
</Card>
<Card
background="elevated"
header={{
heading: "Elevated Card",
subheading: "With shadow and hover effect",
}}
interactive
>
<p class={css({ margin: "0" })}>
An elevated card with interactive hover state.
</p>
</Card>
</div>The size prop controls the padding of the header, content, and footer sections, as well as the heading font size.
Compact padding and font sizes
Small card body content.
Default padding and font sizes
Medium card body content.
Generous padding and font sizes
Large card body content.
---
import Card from "../Card.astro";
import { stack } from "@pindoba/styled-system/patterns";
import { css } from "@pindoba/styled-system/css";
---
<div class={stack({ gap: "lg", direction: "column", width: "100%" })}>
<div>
<h3>Small</h3>
<Card
size="sm"
header={{
heading: "Small Card",
subheading: "Compact padding and font sizes",
}}
footer={{ leading: "Footer", trailing: "Action" }}
>
<p class={css({ margin: "0" })}>Small card body content.</p>
</Card>
</div>
<div>
<h3>Medium (default)</h3>
<Card
size="md"
header={{
heading: "Medium Card",
subheading: "Default padding and font sizes",
}}
footer={{ leading: "Footer", trailing: "Action" }}
>
<p class={css({ margin: "0" })}>Medium card body content.</p>
</Card>
</div>
<div>
<h3>Large</h3>
<Card
size="lg"
header={{
heading: "Large Card",
subheading: "Generous padding and font sizes",
}}
footer={{ leading: "Footer", trailing: "Action" }}
>
<p class={css({ margin: "0" })}>Large card body content.</p>
</Card>
</div>
</div>The card’s header and footer slots accept rich content. Place an icon in the leading position to help users identify the card’s category at a glance, add a ghost button to trailing for contextual actions like settings or a menu, and use the footer trailing for primary and secondary action buttons.
Last edited 2 hours ago
An icon in the header leading slot helps users quickly identify the card's category or type at a glance.
Configure your project preferences
A ghost icon button in the header trailing slot is a common pattern for contextual actions like editing, sharing, or opening a menu.
Update your personal information
Action buttons in the footer trailing slot follow a standard confirm/cancel pattern, keeping primary actions clearly separated from the card's content.
---
import Card from "../Card.astro";
import Button from "@pindoba/astro-button";
import Badge from "@pindoba/astro-badge";
import { Icon } from "astro-icon/components";
import { stack, flex } from "@pindoba/styled-system/patterns";
import { css } from "@pindoba/styled-system/css";
---
<div class={stack({ gap: "xl", direction: "column" })}>
<div>
<h3>Icon in Header</h3>
<Card
header={{
heading: "Document",
subheading: "Last edited 2 hours ago",
}}
>
<Icon name="lucide:file-text" size={20} slot="heading-leading" />
<Icon name="lucide:clock" size={14} slot="subheading-leading" />
<Badge feedback="warning" slot="header-trailing">
<Icon name="lucide:pencil" class={css({ w: "1em", h: "1em" })} />
Draft
</Badge>
<p class={css({ margin: "0" })}>
An icon in the header leading slot helps users quickly identify the
card's category or type at a glance.
</p>
</Card>
</div>
<div>
<h3>Button in Header</h3>
<Card
header={{
heading: "Project Settings",
subheading: "Configure your project preferences",
}}
>
<Icon name="lucide:settings" size={20} slot="header-leading" />
<div class={flex({ gap: "sm", align: "center" })} slot="header-trailing">
<Badge feedback="primary" emphasis="secondary">
<Icon
name="lucide:flask-conical"
class={css({ w: "1em", h: "1em" })}
/>
Beta
</Badge>
<Button emphasis="ghost" shape="circle">
<Icon name="lucide:ellipsis" />
</Button>
</div>
<p class={css({ margin: "0" })}>
A ghost icon button in the header trailing slot is a common pattern for
contextual actions like editing, sharing, or opening a menu.
</p>
</Card>
</div>
<div>
<h3>Buttons in Footer</h3>
<Card
header={{
heading: "User Profile",
subheading: "Update your personal information",
}}
>
<Icon name="lucide:user" size={20} slot="heading-leading" />
<Badge feedback="success" slot="header-trailing">
<Icon name="lucide:circle-check" class={css({ w: "1em", h: "1em" })} />
Active
</Badge>
<p class={css({ margin: "0" })}>
Action buttons in the footer trailing slot follow a standard
confirm/cancel pattern, keeping primary actions clearly separated from
the card's content.
</p>
<div class={flex({ gap: "sm" })} slot="footer-trailing">
<Button emphasis="secondary">Cancel</Button>
<Button>Save</Button>
</div>
</Card>
</div>
</div>The passThrough prop provides escape hatches for advanced customization: style accepts any Panda CSS SystemStyleObject applied to any slot, and props forwards arbitrary HTML attributes.
Using passThrough for advanced customization
This card uses passThrough to apply custom styles to specific slots.
---
import Card from "../Card.astro";
import { stack } from "@pindoba/styled-system/patterns";
import { css } from "@pindoba/styled-system/css";
---
<div class={stack({ gap: "md", direction: "column", width: "100%" })}>
<Card
feedback="primary"
border="default"
header={{
heading: "Custom Styled Card",
subheading: "Using passThrough for advanced customization",
}}
passThrough={{
root: {
style: { borderStyle: "dashed" },
},
heading: {
style: { color: "primary.text" },
},
}}
>
<p class={css({ margin: "0" })}>
This card uses passThrough to apply custom styles to specific slots.
</p>
</Card>
</div>| Prop | |
|---|---|
size | size Controls padding for header, content, and footer sections, and the heading font size. sm: compact. md: default. lg: generous. Type Default Required |
background | background Surface background style forwarded to Panel. surface: standard surface color. sunken: recessed background. elevated: raised with shadow. transparent: no background. Type Default Required |
feedback | feedback Semantic color palette forwarded to Panel. Type Default Required |
border | border Box-shadow ring border forwarded to Panel. Type Default Required |
radius | radius Border radius of the card, forwarded to Panel. Type Default Required |
padding | padding Outer padding of the card, forwarded to Panel. Note: header, content, and footer have their own internal padding controlled by size. Type Default Required |
interactive | interactive Apply pointer cursor and hover/active states. Type Default Required |
accent | accent Use the full-color (500) palette color as the background. Type Default Required |
translucent | translucent Apply a frosted glass effect with backdrop blur. Type Default Required |
header | header Configuration object for the card header section. Type Default Required |
footer | footer Configuration object for the card footer section. Type Default Required |
passThrough | passThrough Custom styling and props for card slots. Each slot accepts style (SystemStyleObject) and props (HTML attributes). Type Default Required |
...rest | ...rest Standard HTML div attributes Type Default Required |
PrimitiveCardHeaderProps)| Prop | |
|---|---|
heading | heading Main heading content. Can be a string, or an object with content, leading, and trailing. Type Default Required |
subheading | subheading Subheading content below the main heading. Type Default Required |
leading | leading Content displayed at the start of the header (e.g., an icon). Type Default Required |
trailing | trailing Content displayed at the end of the header. Type Default Required |
passThrough | passThrough Custom styling and props for header slots. Type Default Required |
PrimitiveCardFooterProps)| Prop | |
|---|---|
leading | leading Content displayed at the start of the footer. Type Default Required |
trailing | trailing Content displayed at the end of the footer. Type Default Required |
children | children Main footer content. Type Default Required |
passThrough | passThrough Custom styling and props for footer slots. Type Default Required |
| Prop | |
|---|---|
content | content The main content of the title. Type Default Required |
leading | leading Content before the title. Type Default Required |
trailing | trailing Content after the title. Type Default Required |