Skip to main content
Login

Sign in to access your account

Cards - National Design System

A card groups one unit of content, such as a service, a product, an article, or a metric, into a single box

Overview

A card holds one unit in a set, such as a service tile, a product, an article preview or a dashboard number. The optional header holds an icon, an image or an avatar. In a panel card, it holds the title too. The content holds a title and text, and optional actions go after it. The whole card can be one link. To let the text expand in place, see Expandable Content.

Pick the options by what the card holds. The header can be an icon, an image or an avatar, or the card can have no header. The content can add tags, a rating, a price, or a status tag in the corner. The layout can be Row. The builder and the Variants table in this page’s source list every option.

Pick another component when:

  • the message is a short status: Alert
  • the user must make a decision: Modal
  • a number needs a trend line: Metric

Markup

Options
Structure
Layout
Meta
Value
Corner
Actions
Box
Color
Size
Number size
Text size
More
Preview
Card Title Card Subtitle

Short description of this card content goes here for demonstration.

<div class="nds-card nds-stroke"> <div class="nds-card-header"> <div class="nds-card-featured-icon"> <span class="nds-featured-icon nds-circle"> <i class="hgi hgi-stroke hgi-stars"></i> </span> </div> </div> <div class="nds-card-content"> <div class="nds-card-text"> <span class="nds-card-title">Card Title</span> <span class="nds-card-subtitle">Card Subtitle</span> <p class="nds-card-description">Short description of this card content goes here for demonstration.</p> </div> </div> </div>

Built-in Features

  • CSS Only

    A card needs no script and no init call. Every look comes from classes.

  • Interactive States

    An <a> or <button> card changes its background on hover. A stroke card also changes its border, and a shadow card deepens its shadow.

  • Image Control

    The image keeps a 2:1 ratio by default. The ratio, the focal point and a dark overlay are set with custom properties on the image.

  • Loading Skeleton

    A card shows skeleton placeholders until the page reveals. Add nds-loading to show them while your own data loads.

  • Filter Ready

    Filter treats each .nds-card as one item by default, and searches the text in .nds-card-content.

  • Nested Cards

    A card resets its color, spacing and width properties, so a value set on an outer card does not reach a card inside it.

Best Practices

  • Make a whole card clickable only for a navigation tile: <a> or <button> as the card root, with an icon, a title and at most one line. A card that carries an action, a price or tags keeps action buttons. Do not wrap a card in a separate link, and do not put links or buttons inside a clickable card.
  • For a list of page links, use a Drawer, not cards: its arrows show that each row is a link.
  • Use a stroke card in flat, content-heavy layouts, and a shadow card where the card floats over other content.
  • Put nds-center on the card root only. On an inner part, it centers nothing.
  • Add nds-middle when a row card’s header is taller than its text, such as a progress ring beside one title. Without it, the text sits at the top.
  • nds-center centers the card’s content, not the card. To center the card itself, center it with its container: nds-center on an nds-grid, or on an nds-flex wrapper for a single card.
  • A card fills its container. To stop it at a width, set --card-width-max. Do not use nds-full-width on a card: inside a section, it breaks out to the full screen width.
  • Put .nds-card-actions after .nds-card-content, not inside it. In a modal, only the content scrolls. Actions inside the content still work there, because the modal pins them to the bottom.
  • To make a whole card smaller or larger, put nds-sm or nds-lg on the card, not a size class on each part. The card changes every part together.
  • On a Modal, a Definition List or a Stepper, nds-sm and nds-lg set that component’s own size, not the card’s.
  • Leave the size class off an icon, an avatar, a progress ring, a tag, a rating or a corner button: the card’s size sets it. Write a size class on a part only for a custom size.
  • Show a price with .nds-card-value, not with a tag.
  • In .nds-card-value, put the value in an element: a number in .nds-number-format, a word such as Free in a <span>. Bare text there shows as the small unit, such as / kg.
  • Keep the description to one or two lines. For longer text, truncate it or link to a detail page.
  • Do not put a card inside a card. Use .nds-card-meta or a definition list inside the content.
  • Use data-status only when the card really has that status. For a color without a status, use the color class.
  • Show an outcome inside a page with a status card. A Status Section is a whole page, with nothing else shown but the page hero.
  • Put a row of cards in a grid.
  • For a set of cards, use a List: each card is a list item, and the list sets the look they share. A set of link cards stays a Grid.
  • To show a card’s content with no box, add nds-flush. It drops the padding, the border, the fill and the shadow.
  • Put a card’s small extras in .nds-card-corner, first in .nds-card-text: a status tag, a menu or “View all” button, or a select checkbox. A bare button in the header shrinks when the title is long, and its label spills out.
  • Keep .nds-card-tags for standard tags that describe the item. A state, such as stock or a request’s status, is a status tag in .nds-card-corner, never in the tag row.
  • Keep the corner to one or two small items: a tag, a subtle or icon-only button, or a checkbox. The corner makes a tag XS and a button SM, one step bigger in an nds-lg card, and a size class on the part still wins. A wide corner meets the header icon on a narrow card.
  • Write the tag first and the checkbox last, so the checkbox sits in the corner.
  • A card the user selects holds no buttons in its corner. Picking it and opening it are two different actions.
  • Over an image, give the status tag .nds-dark.
  • Use the Header title structure for a panel card that holds a list, a table or a chart. For a card in a set of tiles, keep the title in the content.
  • Leave out the header icon when the content shows icons of its own, such as Drawer rows with icons or Date Tiles. A header icon beside them reads as one more row. Keep the title alone in the header.
  • Add nds-breakout only to a drawer or a definition list. Another part breaks out too, but its content then touches the card border.
  • Give a disabled card inert too. Without it, the card only fades its links and buttons, and the keyboard can still reach them.

API

Data Attributes

Attribute Element Effect
data-status .nds-card The status of the card: neutral, warning, error, critical, info or success. It shows the matching color
data-status any parent of .nds-card Colors the card’s featured icons, as on the card itself
data-state~="loading" .nds-card, or a parent .nds-grid, .nds-paged-content or .nds-swiper Skeleton placeholders on the card, or on every card inside the parent. The same as the nds-loading class

CSS Custom Properties

Set these on .nds-card, or on a parent to set every card inside it. The image properties go on .nds-card-image. A card inside a card does not take the outer card’s values or size. A property wins over the size classes.

Property Default Controls
--card-bg var(--background-card) Background
--card-bg-hover var(--background-card-hovered) Background of a hovered link or button card
--card-bg-active the hover fill, a step deeper Background of a pressed link or button card
--card-border-color var(--border-neutral-primary) Border color of a stroke card
--card-border-color-hover var(--border-primary) Border color on hover
--card-border-color-active var(--border-neutral-primary) Border color on press
--card-padding var(--spacing-xl) Padding on both axes. Write 0px, not 0: the corner and a breakout part do math with it, and a bare 0 breaks that
--card-padding-block var(--card-padding) Top and bottom padding
--card-padding-inline var(--card-padding) Start and end padding. Card-style tab panels read it too
--card-gap var(--spacing-3xl), var(--spacing-xl) on phones Gap between header, content and actions, and between the rows in .nds-card-meta. Size SM and LG change it
--card-radius var(--radius-lg) Corner radius
--card-width 100% Width
--card-width-min 0 Minimum width
--card-width-max var(--card-width), else none Maximum width
--card-title-color var(--text-display) Title color
--card-subtitle-color var(--text-secondary) Subtitle color
--card-text-color var(--text-primary-paragraph) Description color
--card-number-color var(--text-primary-strong) Color of the headline number, .nds-card-number
--card-rating-color var(--text-secondary-paragraph) Rating count color
--card-title-FS, --card-title-LH var(--typo-text-lg-FS), var(--typo-text-lg-LH) Title font size and line height. Size and Text size change it
--card-subtitle-FS, --card-subtitle-LH var(--typo-text-md-FS), var(--typo-text-md-LH) Subtitle font size and line height. Size and Text size change it
--card-description-FS, --card-description-LH var(--typo-text-md-FS), var(--typo-text-md-LH) Description font size and line height. Size and Text size change it
--featuredicon-size 48px Featured icon size. Size SM and LG change it
--featuredicon-color var(--featuredicons-icon-primary) Featured icon and avatar color. Color classes change it
--featuredicon-bg var(--featuredicons-background-primary-light) Featured icon background
--card-image-width 160px Image width in a row card. A wider image stacks the card sooner. No effect on a stacked card, where the image fills the width. Size SM and LG change it
--image-ratio 2 / 1 Image aspect ratio. The image header shares these properties with Image
--image-pos-x 50% Horizontal focal point of the image
--image-pos-y 50% Vertical focal point of the image
--image-overlay-opacity 0 How much the overlay covers the image, from 0 to 1
--image-overlay-color var(--background-image-overlay) The overlay color
--image-radius var(--radius-md) Corner radius of the image

Tokens

It reads these shared tokens. A change to one also changes other components: see Tokens.

Source: the var() reads in _sass/components/_card.scss.

TokenPreviewValue
--background-card
var(--colors-base-white)
Dark mode var(--background-default)
--background-card-hovered
var(--colors-neutral-50)
Dark mode var(--colors-alpha-white-10)
--background-primary-light
var(--colors-primary-50)
Dark mode var(--colors-primary-alpha-10)
--background-success-light
var(--colors-green-50)
Dark mode var(--colors-green-alpha-10)
--background-info-light
var(--colors-blue-50)
Dark mode var(--colors-blue-alpha-10)
--background-warning-light
var(--colors-yellow-50)
Dark mode var(--colors-yellow-alpha-10)
--background-error-light
var(--colors-red-50)
Dark mode var(--colors-red-alpha-10)
--background-disabled
var(--colors-neutral-200)
Dark mode var(--colors-neutral-700)
--background-inverse-disabled
Read by --featuredicon-bg

var(--colors-neutral-100)
Dark mode var(--colors-neutral-600)
--text-default
Read by --card-bg-active

var(--colors-base-black)
Dark mode var(--colors-neutral-200)
--text-display
var(--colors-neutral-800)
Dark mode var(--colors-neutral-100)
--text-primary-paragraph
var(--colors-neutral-700)
Dark mode var(--colors-neutral-300)
--text-secondary-paragraph
var(--colors-neutral-500)
Dark mode var(--colors-neutral-400)
--text-primary-strong
var(--colors-primary-700)
Dark mode var(--colors-primary-400)
--text-secondary
var(--colors-secondary-800)
Dark mode var(--colors-secondary-400)
--text-oncolor-primaryvar(--colors-base-white)
--text-oncolor-secondaryvar(--colors-alpha-white-80)
--text-success
var(--colors-green-700)
Dark mode var(--colors-green-400)
--text-info
var(--colors-blue-700)
Dark mode var(--colors-blue-400)
--text-warning
var(--colors-yellow-700)
Dark mode var(--colors-yellow-400)
--text-error
var(--colors-red-700)
Dark mode var(--colors-red-400)
--text-default-disabledvar(--colors-neutral-400)
--border-primaryvar(--colors-primary-600)
--border-primary-light
var(--colors-primary-200)
Dark mode var(--colors-primary-400)
--border-neutral-primary
var(--colors-neutral-300)
Dark mode var(--colors-neutral-600)
--border-neutral-secondary
var(--colors-neutral-200)
Dark mode var(--colors-neutral-700)
--border-neutral-tertiary
Read by border

var(--colors-neutral-100)
Dark mode var(--colors-neutral-750)
--border-success-light
var(--colors-green-200)
Dark mode var(--colors-green-400)
--border-info-light
var(--colors-blue-200)
Dark mode var(--colors-blue-400)
--border-warning-light
var(--colors-yellow-200)
Dark mode var(--colors-yellow-400)
--border-error-light
var(--colors-red-200)
Dark mode var(--colors-red-400)
--border-disabled
var(--colors-neutral-300)
Dark mode var(--colors-neutral-600)
--icon-default-disabled
Read by --featuredicon-color
var(--colors-neutral-400)
--nds-area-image
Read by background-image
none
--nds-area-color#{map.get($fill, start)}
--featuredicons-icon-oncolor
Read by --featuredicon-color
var(--colors-base-white)
--featuredicons-background-neutral-light
Read by --featuredicon-bg

var(--background-neutral-light)
Dark mode var(--colors-alpha-white-10)

JavaScript

Cards have no script, methods or events.

Last Modified Date: 20/11/2026 - 05:15 PM
Was this page useful?
60% of users said Yes from 2843 Feedbacks