Skip to main content

Module card

Module card 

Source
Expand description

Card — a surface container with optional header, content, and footer slots.

Card renders an opaque or tinted rounded-rectangle backdrop, an optional drop shadow, and up to three stacked content slots (header / content / footer). It is the standard building block for list-item cards, dashboard tiles, onboarding panels, and any widget that needs a visually distinct raised or outlined surface. Chrome (shadow, background, corner radius, padding) is delegated to the active CardStyle so the visual language can be changed per-call (.style(...)) or theme-wide via theme.style_slots.card.

§When to use

  • CardVariant::Elevated — a dashboard tile or list card that should “float” above the page surface.
  • CardVariant::Outlined — a bordered grouping box without shadow.
  • CardVariant::Plain — the content sits on the default surface; no visible chrome (useful for spacing only).

§Accessibility

Announces as Role::Group. The slots’ own accessibility nodes are included in the subtree; the card itself carries no additional AT name.

let _card = Card::new()
    .variant(CardVariant::Elevated)
    .content(TextWidget::new(lit!("Hello, card!")));

Structs§

Card
A card container with shadow, background, and optional header/content/footer.