Skip to main content

Card Component

Introduction​

The Card Component wraps content in a styled MUI Card surface. It supports an optional click handler (onClick) that makes the card interactive — clicking it triggers an action sequence (e.g., navigation, dialog, mutation). Without onClick, the card renders as a static, non-interactive surface.

YAML Structure​

component: card
name: <string>
props:
options:
variant: <"elevation" | "outlined">
elevation: <number>
className: <string>
bgcolor: <string>
color: <string>
style:
light: <CSSProperties>
dark: <CSSProperties>
header:
title: <string | localized object>
titleType: <h1 | h2 | h3 | h4 | h5 | h6>
subheader: <string | localized object>
icon: <string>
iconColor: <string>
badge: <badge props>
action: <component list>
sx: <SxProps>
actions:
sx: <SxProps>
disableContentWrapper: <boolean>
contentSx: <SxProps>
contentClassName: <string>
contentProps: <CardContentProps>
sx: <SxProps>
className: <string>
onClick: <action_sequence>
children:
- <component>

Structure Breakdown​

ElementTypeDescription
componentstringAlways card
namestringUnique identifier for the card instance
props.optionsobjectStyling and layout options
props.classNamestringAdditional CSS classes on the card root. A className placed beside props is ignored
props.onClickarrayActions fired when the card is clicked; presence makes the card interactive
childrenarrayChild components rendered inside the card

Attribute Description​

props.options​

Sub-propTypeDescription
variantstringMUI card variant: elevation (default) or outlined
elevationnumberShadow depth when variant: elevation
classNamestringAdditional CSS classes for the card root
bgcolorstringBackground color
colorstringText color
styleobjectTheme-aware root styles. style.light applies in light mode and style.dark applies in dark mode. These styles are applied after sx and can override it. Only light and dark are read: CSS keys placed directly under style are ignored and fail validation. Use sx for styles that do not depend on the theme
headerobjectOptional header row, see below
actionsobjectRenders an empty CardActions row (padding only) styled by sx; it holds no buttons
disableContentWrapperbooleanIf true, children are rendered directly without CardContent
contentSxobjectMUI sx props applied to the CardContent element
contentClassNamestringCSS class applied to CardContent (default: card-content)
contentPropsobjectAdditional props spread onto CardContent
sxobjectMUI sx props applied to the card root

props.options.header​

The header holds the section title, so a heading belongs here and not in a text component above the card. Unknown header keys fail validation.

Sub-propTypeDescription
title, subheaderstring, template or localized objectHeader text
titleTypeh1–h6Renders the title as a semantic section heading; without it, the compact card-header style is used
icon, iconColorstringHeader avatar icon (template-aware); the color defaults to text.secondary
badgebadge propsRenders a badge immediately after the title. label is required; nothing renders when it resolves empty
actioncomponent arrayRenders controls such as a dropdown or a stats amount at the right of the header
sxobjectMUI sx props on the header
caution

Clicks inside header.action currently bubble up to the card. On a card with onClick, opening an Actions menu in the header also runs the card's onClick. Don't combine the two.

props.onClick​

  • Type: array (actions list)
  • Description: When present, the card becomes an accessible interactive surface. Clicking it or pressing Enter/Space while it is focused executes the action sequence. It receives the card's name as sender and the parent's variables as context. Keyboard events from nested controls do not trigger the card action.

Examples​

Static Card (non-interactive)​

component: card
props:
options:
variant: outlined
header:
title: "Order Summary"
subheader: "Shipment #12345"
disableContentWrapper: false
children:
- component: text
props:
value: "Package delivered successfully."

Interactive Card with onClick​

component: card
props:
options:
variant: elevation
elevation: 2
bgcolor: "#f5f5f5"
header:
title: "Customer Details"
className: "customer-card"
onClick:
- navigate: "/customers/{{ customerId }}"
children:
- component: text
props:
value: "{{ customerName }}"

Card Opening a Dialog​

component: card
name: orderCard
props:
options:
header:
title:
en-US: "Order #{{ orderId }}"
icon: "{{ orderIcon }}"
onClick:
- dialog:
name: orderDetailsDialog
component:
component: Orders/Detail
props:
id: "{{ orderId }}"
children:
- component: layout
props:
cols: 2
children:
- component: text
props:
label: "Status"
value: "{{ orderStatus }}"
- component: text
props:
label: "Total"
value: "{{ format orderTotal currency USD }}"

Card Header Badge and Action​

component: card
name: invoiceCard
props:
options:
header:
title: "Invoice {{ invoiceForm.transactionNumber }}"
titleType: h2
badge:
label: "{{ invoiceForm.status }}"
action:
- component: stats
props:
size: lg
align: end
items:
- label: Amount Due
value: "{{ invoiceForm.amountDue }}"
unit: USD
children: []

Styled Card with Content Props​

component: card
props:
options:
variant: outlined
contentSx:
padding: 2
contentProps:
id: order-card-content
contentClassName: "order-card-content"
children:
- component: text
props:
value: "Card content with custom padding and class."

Theme-Aware Card Styling​

component: card
name: metricCard
props:
options:
variant: outlined
sx:
borderRadius: 2
style:
light:
backgroundColor: "#ffffff"
borderColor: "#d7dee8"
dark:
backgroundColor: "#121826"
borderColor: "#344054"
color: "#f8fafc"
children:
- component: text
props:
value: "Card root styles change with the active theme."