Card container with composable header, body, and footer slots.
Examples
<%!-- Simple card with all slots --%>
<.card>
<:header>
<.card_title>Server #3</.card_title>
<.card_description>Last ping 2s ago</.card_description>
</:header>
<:body>
<p>CPU: 14%</p>
</:body>
<:footer>
<.button size="sm">Restart</.button>
</:footer>
</.card>
<%!-- Flat variant (no shadow, minimal border) --%>
<.card variant="flat" class="p-6">
Content here
</.card>
<%!-- With hover effect for clickable cards --%>
<.card variant="interactive" phx-click="select" phx-value-id={@item.id}>
Clickable card
</.card>
Summary
Functions
Renders a card container with optional header, body, and footer sections.
Card description — muted subtitle inside :header slot.
Card title — rendered inside :header slot.
Functions
Renders a card container with optional header, body, and footer sections.
Attributes
variant(:string) - Defaults to"default". Must be one of"default","flat", or"interactive".padding(:string) - Defaults to"md". Must be one of"none","sm","md", or"lg".class(:string) - Defaults tonil.- Global attributes are accepted. Supports all globals plus:
["phx-click", "phx-target", "id"].
Slots
headerbodyfooterinner_block
Card description — muted subtitle inside :header slot.
Attributes
class(:string) - Defaults tonil.
Slots
inner_block(required)
Card title — rendered inside :header slot.
Attributes
class(:string) - Defaults tonil.
Slots
inner_block(required)