Card
Displays a card with header, content, and footer.
Installation
Command to install the Card component.
Component Guide
Use the following to build the Card component.
from components.ui.card import cardSource Code & Dependencies
For manual installation, copy each of the source codes below in their respective locations.
components/core/core.py
components/ui/card.py
Examples
Size
Use size="sm" for tighter spacing throughout the card.
Props used: size on card.root.
Spacing
Beyond size, use the --card-padding and --card-gap CSS variables directly to control the card's inset and section spacing. --card-padding sets the padding inside the card (and each section's horizontal inset); --card-gap sets the space between header, content, and footer.
Props used: class_name (setting --card-padding and --card-gap inline) on card.root.
Use negative margins with -mx-(--card-padding) to let content go edge-to-edge while staying aligned with the card's inset. When edge-to-edge content sits above a footer, add -mb-(--card-gap) on card.content to remove the section gap.
Image
Add an image before card.header to create a card with a cover image — corner radii adjust automatically for first/last-child images.
Props used: none required — place rx.el.img(...) as the first child of card.root.
API Reference
card.root
card.root(
card.header(card.title("Team members")),
card.content("..."),
size="sm",
)
card.header
For a title, description, and optional action.
card.header(
card.title("Team members"),
card.description("Manage who has access."),
card.action(button("Invite", size="sm")),
)
card.title
card.title("Team members")
card.description
card.description("Manage who has access to this project.")
card.action
Places content in the top-right of the header (a button, badge, etc.).
card.action(button("Invite", size="sm"))
card.content
card.content("Main card body content.")
card.footer
card.footer(button("Cancel", variant="ghost"), button("Save"))