v1.6.x-dev NDS IQ v6

Loading Component - National Design System

A versatile loading spinner for indicating loading states across any element

Loading Spinner

Add data-state="loading" or .nds-loading to any container to dim its content and show a centered spinner

Default Loading

Content is dimmed while loading

<div data-state="loading"> <p>Content is dimmed while loading</p> </div> <!-- Or use class toggle --> <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"> Content hidden while loading </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 or attribute 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

  • Prefer data-state="loading" for JS-toggled states; prefer the nds-loading class when the state is server-rendered or set via a simple class toggle
  • 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
  • Do not add nds-loading directly to .nds-btn: buttons handle their own loading state and the child-dim rule is already excluded for them
  • 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"Alternate trigger for the loading state. Equivalent to the nds-loading class; 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 or data-state="loading" is applied to the following elements, 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: 02/07/2026 - 09:17 PM
Was this page useful?
60% of users said Yes from 2843 Feedbacks