Loading Component - National Design System

A versatile loading spinner for indicating loading states across any element

Loading Spinner

Add .nds-loading to any container to dim its content and show a centered spinner. JS-toggled state can set data-state="loading" instead; nds-core mirrors it onto the class

Default Loading

Content is dimmed while loading

<div class="nds-loading"> <p>Content is dimmed while loading</p> </div>
On-color Loading (Dark Background)

Content is dimmed while loading

<div class="nds-loading nds-oncolor"> <p>Content is dimmed while loading</p> </div>

Neutral

Black spinner on light backgrounds, automatically inverts to white in dark mode

Neutral Loading

Content is dimmed while loading

<div class="nds-loading nds-neutral"> <p>Content is dimmed while loading</p> </div>

Size Variants

Loading spinners are available in 7 sizes: xxs (20px), xs (24px), sm (28px), md (32px default), lg (36px), xl (40px), 2xl (44px)

All Sizes
XXS (20px)
XS (24px)
SM (28px)
MD (32px)
LG (36px)
XL (40px)
2XL (44px)
<div class="nds-loading nds-xxs">...</div> <!-- 20px --> <div class="nds-loading nds-xs">...</div> <!-- 24px --> <div class="nds-loading nds-sm">...</div> <!-- 28px --> <div class="nds-loading">...</div> <!-- 32px (default) --> <div class="nds-loading nds-lg">...</div> <!-- 36px --> <div class="nds-loading nds-xl">...</div> <!-- 40px --> <div class="nds-loading nds-2xl">...</div> <!-- 44px -->

Built-in Features

CSS Only

No JavaScript required. Add the class and the spinner renders immediately via CSS ::after.

Automatic Dark Mode

The default spinner inverts to white in dark mode. nds-neutral follows the same inversion automatically.

Interaction Blocked

pointer-events: none is applied to the loading container, preventing clicks on dimmed content.

Skeleton Suppression

On skeleton-capable elements (grids, cards, accordions, tabs, tables), the spinner is suppressed and child opacity is restored so the skeleton provides the feedback.

Usage Guidelines

Best Practices

  • Use the nds-loading class in markup and in simple class toggles. For JS-toggled state, call NDS.State.add(el, 'loading'); nds-core mirrors the token onto the class, and the CSS reads the class only
  • Add nds-neutral when the spinner appears over a white or light-tinted surface where the default primary-colored spinner would clash
  • Add nds-oncolor when the container background is always dark (for example, a primary-colored banner); this forces the spinner white regardless of color scheme
  • Buttons carry their own loading look: the spinner replaces the label and the child-dim rule is excluded for them. Set the token from JS with NDS.State.add(btn, 'loading'), or the class in markup
  • On skeleton-capable elements (.nds-grid, .nds-card, .nds-accordion, .nds-tabs, tbody), the skeleton IS the visual feedback; the spinner is automatically suppressed by CSS and you do not need to handle it separately
  • Size the spinner to match the container: use nds-xxs or nds-xs inside compact components (table cells, small cards) and nds-xl or nds-2xl for full-page overlays

Modifier Classes

ClassDescription
nds-neutralBlack spinner on light backgrounds; inverts to white in dark mode
nds-oncolorForces a white spinner regardless of color scheme, for use on always-dark backgrounds
nds-xxsSpinner 20px, border 2px
nds-xsSpinner 24px, border 2px
nds-smSpinner 28px, border 2px
nds-mdSpinner 32px, border 3px (same as the default)
nds-lgSpinner 36px, border 3px
nds-xlSpinner 40px, border 4px
nds-2xlSpinner 44px, border 4px

Data Attributes

AttributeDescription
data-state="loading"The JS token for the loading state. nds-core mirrors it onto the nds-loading class, and the CSS reads the class only, so this form needs the NDS JS bundle. Useful when a component already manages data-state for other states

CSS Custom Properties

PropertyDefaultDescription
--loading-color--background-primary (white in dark)Spinner arc color
--loading-track--colors-alpha-black-10 (colors-alpha-white-20 in dark)Spinner track (background ring) color
--loading-size32pxDiameter of the spinner
--loading-border3pxStroke width of the spinner ring
--loading-opacity0.15Opacity applied to child elements while loading

Skeleton Processing State

When nds-loading is applied to the following elements (or data-state="loading", which nds-core mirrors onto it), the spinner (::after) is suppressed and child opacity is restored to 1. The skeleton styling defined in each component provides the visual feedback instead. pointer-events: none still applies.

ElementNotes
.nds-gridCard grids in a loading state show skeleton cards
.nds-paged-contentPaginated content region; skeleton suppresses spinner during page turns
tbody, .nds-tableTable body and table wrapper; skeleton rows replace the spinner
.nds-accordionAccordion panels show skeleton items
.nds-tabs, .nds-tab-listTab strip and tab panels
.nds-cardIndividual card in a loading state shows a skeleton body
.nds-definition-listDefinition list
.nds-stepperStepper component
.nds-breadcrumb-navBreadcrumb navigation
Last Modified Date: 03/09/2026 - 01:31 AM
Was this page useful?
60% of users said Yes from 2843 Feedbacks