Skip to main content
Login

Sign in to access your account

Section - National Design System

A section is one titled block of page content, with an optional action, image and background color

Overview

All page content sits in sections. A section is a section.nds-content-section. Its wrapper groups the head (a title and a description), an optional action, an optional image and the body. The section sets the page gutter, the space above and below, and the background. Sections need no JavaScript.

Pick another component when:

  • the content is a group inside a section, with no background of its own: Block
  • the section shows an outcome, such as a page not found: Status Section
  • the content is one item in a set: Cards
  • the content folds open and closed: Accordion

Markup

Options
Structure
Action
Float action
Color
More
Preview
<section class="nds-content-section"> <div class="nds-section-wrapper"> <div class="nds-section-head"> <h2 class="nds-section-title">Digital Services</h2> <p class="nds-section-description">Services you can complete online, without a visit to a branch.</p> </div> <div class="nds-section-body nds-prose"> <p>Apply for a permit, renew a license or track a request from your account.</p> </div> </div> </section>

Behavior

No Wrapper

A section with no action and no image can leave out nds-section-wrapper: its nds-section-head and nds-section-body then sit straight in the section. It looks the same as a section with a wrapper.

Horizontal Layout

nds-horizontal on the section makes the wrapper a grid of two columns at 960px and wider: the head, then the body. Below 960px the wrapper stacks again. Add nds-grid to the wrapper to set the column widths with --max-track: see Grid.

Stacked Wrappers

Each nds-section-wrapper after the first starts a new titled block, with --section-wrapper-gap above it. The blocks share the section background. In card view they are one card, and with stripes they are one stripe. Both are set on the page, not on the section: see Page Layout.

Breakout

A body with nds-breakout cancels the section’s side padding, so its content runs to the section edges. Put it after the wrapper, as a direct child of the section, not inside the wrapper. nds-full-width on an element in a section goes further, to the edges of the screen. The two differ where the section is narrower than the screen, such as beside a side menu.

Standard Action

A nds-section-action after the head sits beside it on a desktop, at the top. Below 600px it takes its own row, and each button is full width. In the body, at any depth, its buttons are full width below 600px too. As a direct child of the body, it keeps 32px of space above and below it, as a block does.

Float Action

A nds-section-action that is the first child of the head floats to the end corner. The title and the description wrap around it, so it takes no row of its own. The buttons stack in a column and share one width. In a centered or horizontal section it does not float: it goes under the description. Write data-hidden="sm sr" on each button’s label to show only the icons below 600px, where each button goes square, or add nds-wrap to move it under the description there.

Dual Action

A section can hold a float action and a standard action. The standard action then takes its own row on every screen, under the head.

Image

A nds-section-image before the head holds a small image, a logo, an illustration or an avatar. It sits beside the head, and the head centers on it. When the head would get narrower than 13rem, the image moves above it, and a wide image shrinks to fit the section. An avatar in it is 120px, and 80px below 600px.

Center

nds-center stacks the wrapper in one column and centers the head, the action and the body. A title icon goes above the title and is 48px.

Background Colors

The fill words in data-theme paint a dark background, and the section text takes the on-color text colors. dark oncolor primary paints deep primary and dark oncolor primary gradient paints the gradient: the buttons, fields and other components inside take their on-color looks. See Color Areas. dark neutral paints dark neutral: the components take their dark-mode colors. See Dark Areas. primary without dark paints the light brand tint with an inset shadow, and the components keep their colors. The classes nds-primary, nds-gradient-primary, nds-neutral and nds-brand still paint the same backgrounds but are deprecated and go in v3. The gradient runs at -45deg, and at 45deg on an LTR page. A section with a background color is never striped: see Page Layout.

Built-in Features

  • Progressive Structure

    Start with a head and a body. Add an action, an image or a breakout body only when the content needs one.

  • Layout Aware

    The page layout sets the section spacing. A desktop page with no side column gets more space above and below each section, and card view shows each section as a card.

  • Fluid Typography

    The title and the subtitle sizes scale between phone and desktop. The title, subtitle and description stop at 720px wide, for a readable line length.

  • High Contrast

    In high contrast mode every section, including a colored one, takes the high contrast background and text colors.

  • Off-Screen Sections

    While the page loads, the browser skips the style and layout of a section that is not near the screen. It draws them later, one at a time, when it is idle or when the page scrolls near one. After it first draws, the section stays a normal section. The first two sections and a Side Info section always draw.

Best Practices

  • Put each distinct part of a page in its own section, in nds-content.
  • Do not put a section inside a section. Use a block to divide a section body. Stack wrappers when each part needs its own title.
  • Stack wrappers only in card view or on a striped page, where the parts must share one surface.
  • Leave a stacked section without nds-flex and --gap. The section already spaces its wrappers, so a gap doubles every break. Set --section-wrapper-gap to change the space.
  • Use a horizontal section where a short text and an image sit side by side, such as a feature or a call to action.
  • Put a picture in nds-section-image, before the head: a photo, an avatar, a logo, a cover or an illustration. A picture never goes in the title.
  • Put an icon that marks the title in the title: a featured icon with nds-section-icon, before the text. Only a status section puts an icon before the head.
  • Striping counts sections, not wrappers. When you merge sections into one, check the stripes of the sections below it.
  • Use a float action for a secondary action when the head has room. Use a standard action for a main call to action.
  • Use a section action only for an action on that section’s content. Put an action for the whole page, such as a link back to a list, in its own section. Put the section action in the head or right after it; put it in the body only when it acts on the content just above it.
  • Give each button whose label has data-hidden an icon. Without one, the button is empty on a phone.
  • Use a background color on one section at a time. Two dark sections in a row read as one block.
  • Use a breakout body for a swiper or a wide image, not for text.
  • Use nds-full on a title or a description only for short text. Long lines are hard to read.
  • Put two or more parts of a section body in a grid, a flex or a block. The section body is a plain block, so it puts no space between its children.
  • In your own ResizeObserver, change the height of a section’s content only after the section has data-nds-drawn. Before that, the browser reports a “ResizeObserver loop” error.
  • Right after the page shows, a scrollIntoView() call of yours can stop short of a far section. A link to #id on the same page always scrolls to the right place.

API

Other Classes

Class Element Effect
nds-section-subtitle A <p> in .nds-section-head, after the title A line under the title, larger than the description
nds-section-brief A <p> in .nds-section-head One short line in semibold. The hero uses it
nds-section-meta A <div> in .nds-section-head A row that holds a nds-section-tags and a nds-section-rating. The hero uses it
nds-full .nds-section-title, .nds-section-subtitle or .nds-section-description Removes the 720px width limit
nds-full-width Any element in a section Runs to the edges of the screen, past the section padding
nds-section-icon A featured icon in .nds-section-title, before the text. In a status section, an element before .nds-section-head In the title, an icon that grows with the title. In a status section, the box that holds the feedback chip

CSS Custom Properties

Set these on .nds-content-section. The block title properties are on the Block page.

Property Default Controls
--section-bg var(--background-default) Background color. A color class changes the default
--section-shadow none Shadow
--section-border none Border
--section-border-radius 0 Corner radius
--section-title-color var(--text-display) Title color
--section-subtitle-color var(--text-secondary-paragraph) Subtitle color
--section-description-color var(--text-primary-paragraph) Description color
--section-text-color inherit Text color of everything else in the section
--section-padding-block var(--spacing-5xl) Top and bottom padding. On a desktop page with no side column, the layout sets it to var(--spacing-7xl)
--section-padding-block-start var(--section-padding-block) Top padding
--section-padding-block-end var(--section-padding-block) Bottom padding
--section-margin-block-start 0 Top margin
--section-margin-block-end 0 Bottom margin
--section-col-gap var(--spacing-xl) Gap between the image, the head and the action. Also the space around a float action
--section-row-gap var(--spacing-4xl) Gap between the rows of a wrapper
--section-wrapper-gap var(--spacing-6xl) Space above each stacked wrapper
--section-title-FS var(--typo-display-clamp-md-FS) Title font size. Card view uses var(--typo-display-clamp-sm-FS)
--section-title-LH var(--typo-display-clamp-md-LH) Title line height
--section-title-MB var(--typo-display-clamp-md-MB) Space under the title
--section-icon-size var(--section-title-FS), 48px when centered Height of the title icon
--section-subtitle-FS var(--typo-text-clamp-lg-FS) Subtitle font size
--section-subtitle-LH var(--typo-text-clamp-lg-LH) Subtitle line height
--section-subtitle-MB var(--section-title-MB) Space under the subtitle
--section-description-FS var(--typo-text-lg-FS) Description font size
--section-description-LH var(--typo-text-lg-LH) Description line height
--section-description-MB var(--spacing-2xl) Space under the description
--gradient-angle -45deg, 45deg on an LTR page Direction of a gradient background: data-theme="… primary gradient" or nds-gradient-primary
--gap var(--spacing-6xl) Gap between the columns of a horizontal section

JavaScript

Sections have no methods or events. The core script writes data-nds-drawn on a section the first time the browser draws it. Do not set it yourself.

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