Skip to content
Glint UI

Card

A surface with a header, a body and a footer — six exported parts, and none of them an affordance.

Usage

import { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter } from "@glint/components/card.slint";
import { Button } from "@glint/components/button.slint";
import { Tokens } from "@glint/theme/tokens.slint";
export component AppWindow inherits Window {
width: 560px;
height: 300px;
background: Tokens.color-background;
VerticalLayout {
alignment: center;
padding: 24px;
Card {
CardHeader {
title: "Notifications";
description: "Choose what notifications you receive.";
}
CardContent {
Text {
text: "Configure push, email, and SMS alert channels.";
color: Tokens.color-foreground;
}
}
CardFooter {
Button { text: "Save preferences"; }
}
}
}
}

Card serves as a surface container. Its companion helpers (CardHeader, CardTitle, CardDescription, CardContent, CardFooter) establish clean information hierarchy.

Examples

Variants

Cards support CardVariant.solid, CardVariant.glass, CardVariant.glass-interactive, and CardVariant.raised.

Sizes

Use size: CardSize.sm for compact lists or sidebars, and size: CardSize.default for full content sections.

Padding overrides

Override internal container padding using card-padding: CardPadding.none, CardPadding.sm, CardPadding.md, or CardPadding.lg.

Radius overrides

Customize corner roundness with card-radius: CardRadius.md, CardRadius.lg, CardRadius.xl, or CardRadius.xxl.

Title and description type

CardTitle is a Heading and CardDescription is a Body, so both take the type ladder’s own knobs: tone picks the color role on either, level steps the heading, and size steps the description.

API Reference

Properties

PropertyTypeDefaultDescription
variantin CardVariantCardVariant.solidSurface treatment — solid, glass, glass-interactive, raised.
sizein CardSizeCardSize.defaultDensity — the padding around the content and the gap between its sections, together. A compact card is one word (ADR-0022).
card-paddingin CardPaddingCardPadding.autoPadding override — auto (follow size), none, sm, md, lg. Reach for none when the content draws to the border: a full-bleed strip of media or a table, which is not a density choice at all.
card-radiusin CardRadiusCardRadius.xlCorner radius override — md, lg, xl, xxl.
hoveredout boolno defaultRead-only hover signal — driven by the internal TouchArea below. Consumers can read it (e.g. to drive header chip styling) but never set it.
padding-lout lengthno defaultBoth lengths come off size, and card-padding overrides one of them (none/sm/md/lg → 0/12/16/24). The column below applies both. They stay published for content that has to draw to the card's edge — a strip of media, a full-bleed table — and therefore needs to know what it is escaping (MessageBubble's rule).
gap-lout lengthno defaultResolved gap between header / content / footer in px; outbound.

Enums

EnumValues
CardVariantsolid, glass, glass-interactive, raised
CardSizesm, default
CardPaddingauto, none, sm, md, lg
CardRadiusmd, lg, xl, xxl

CardHeader

The top band: the title and description stack on the left, and the trailing place is kept for the control that acts on the card — the @children slot. A header written without one pays nothing for it.

Properties

PropertyTypeDefaultDescription
titlein stringno defaultHeading of the card.
descriptionin stringno defaultLine under the title; empty hides it.

CardTitle

The header’s own heading style, exported for a title that is not inside a CardHeader. level is a step on the type ladder rather than an outline level — see Typography.

Properties

PropertyTypeDefaultDescription
levelin int1Which step, 1 (largest) through 5 (smallest). Out-of-range levels take the smallest step rather than drawing nothing.
tonein TypographyToneTypographyTone.defaultColour role — default, muted, subtle.

Enums

EnumValues
TypographyTonedefault, muted, subtle, accent, danger

CardDescription

The line under the title, at the muted tone and wrapping by word.

Properties

PropertyTypeDefaultDescription
sizein BodySizeBodySize.defaultWhich step — lg, default, sm, label, caption.
tonein TypographyToneTypographyTone.defaultColour role — default, muted, subtle.

Enums

EnumValues
BodySizelg, default, sm, label, caption
TypographyTonedefault, muted, subtle, accent, danger

CardContent

The body of the card.

CardContent publishes no properties, callbacks or functions of its own. What a call site can set on it is the Slint VerticalLayout it inherits.

CardFooter

The row of actions along the bottom, aligned to the end.

CardFooter publishes no properties, callbacks or functions of its own. What a call site can set on it is the Slint HorizontalLayout it inherits.

Accessibility

  • The surface carries no role and takes no name. A card is a container, and Glint gives it no node in the accessibility tree: what a screen reader reads is what you put inside it. A card that is itself one target — a whole tile that opens something — is a Button wrapping the content, not a Card with a click handler.
  • CardTitle is a size, not an outline level. Its level: 5 picks a step on the type ladder (Typography) and nothing more: Heading inherits Slint’s Text and declares no accessible-role, so no heading node reaches the tree and no reading order is built from it. A screen reader hears the title as text in the order it is laid out. Where a card opens a region a reader needs to jump to, name that region at the call site — accessible-role: region and accessible-label together, the way ScrollArea documents.
  • The controls inside are the accessible part. A Button in a CardHeader or a CardFooter keeps its own role, name, focus ring and default action; the card neither adds to that nor gets in its way.