@gemeentenijmegen/layout-css

中文文档
0.1.23发布于 2026/11/12EUPL-1.2零依赖近 30 天下载 2368

CSS layout for a design system based on the NL Design System architecture

原始使用文档
文档目录18 节
  1. Breakpoints
  2. Containers
  3. Default container
  4. Responsive containers
  5. Fluid container (full width)
  6. Grid
  7. Columns
  8. Responsive
  9. Starts
  10. Other
  11. Spacing
  12. Design tokens
  13. Horizontal centering
  14. Examples
  15. Customization
  16. Example via Sass variables
  17. Example via CSS var()
  18. License

Nijmegen Design System Layout

This package contains the css layout options (breakpoints, containers, grid and spacing) for the Design System of the municipality of Nijmegen. The setup of this package is based on the NL Design System principles and is inspired by the Bootstrap v5.3 Layout.

Breakpoints

This layout contains 6 breakpoints which have a default value and are customizable by usings Sass variables based on your design tokens.

BreakpointClass infixDefault dimensionsDesign tokenSass variable
Extra small< 576pxnijmegen.breakpoint.xs$nijmegen-breakpoint-xs
Smallsm≥576pxnijmegen.breakpoint.sm$nijmegen-breakpoint-sm
Mediummd≥768pxnijmegen.breakpoint.md$nijmegen-breakpoint-md
Largelg≥992pxnijmegen.breakpoint.lg$nijmegen-breakpoint-lg
Extra largexl≥1200pxnijmegen.breakpoint.xl$nijmegen-breakpoint-xl
Extra extra largexxl≥1400pxnijmegen.breakpoint.xxl$nijmegen-breakpoint-xxl

Containers

Containers are an implementation of the Bootstrap v5.3 Containers. The implementation contains all three different containers with custom class naming:

  • .nijmegen-container, which sets a max-width at each responsive breakpoint
  • .nijmegen-container-{breakpoint}, which is width: 100% until the specified breakpoint
  • .nijmegen-container-fluid, which is width: 100% at all breakpoints

The following max-width values are used wicht are customizable based on the implementation of the design tokens:

BreakpointDefault max-width valueDesign tokenSass variable
Extra small100%
Small540pxnijmegen.container.max-width.sm$nijmegen-container-max-width-sm
Medium720pxnijmegen.container.max-width.md$nijmegen-container-max-width-md
Large960pxnijmegen.container.max-width.lg$nijmegen-container-max-width-lg
Extra large1140pxnijmegen.container.max-width.xl$nijmegen-container-max-width-xl
Extra extra large1320pxnijmegen.container.max-width.xxl$nijmegen-container-max-width-xxl

Other container design tokens:

Design tokenDefault valueSass variableCss variable
nijmegen.container.padding-inline-startnijmegen.space.25$nijmegen-container-padding-inline-startvar(--nijmegen-container-padding-inline-start)
nijmegen.container.padding-inline-endnijmegen.space.25$nijmegen-container-padding-inline-endvar(--nijmegen-container-padding-inline-end)

Default container

<div class="nijmegen-container">
  <!-- Content here -->
</div>

Responsive containers

<div class="nijmegen-container-sm">100% wide until small breakpoint</div>
<div class="nijmegen-container-md">100% wide until medium breakpoint</div>
<div class="nijmegen-container-lg">100% wide until large breakpoint</div>
<div class="nijmegen-container-xl">100% wide until extra large breakpoint</div>
<div class="nijmegen-container-xxl">100% wide until extra extra large breakpoint</div>

Fluid container (full width)

<div class="nijmegen-container-fluid">
  <!-- Content here -->
</div>

Grid

The grid system is an implementation of the Bootstrap v5.3 CSS Grid. The default setup is a 12 column grid which need to be placed inside the nijmegen-grid element. The grid supports responsive classeds to adjust the layout across viewports.

Design tokenDefault valueSass variableCss variable
nijmegen.grid.columns12$nijmegen-grid-columns
nijmegen.grid.gap1.5rem$nijmegen-grid-gapvar(--nijmegen-grid-gap)
nijmegen.grid.rows1$nijmegen-grid-rowsvar(--nijmegen-grid-rows)

Columns

<div class="nijmegen-grid">
  <div class="nijmegen-g-col-4">col 1/3</div>
  <div class="nijmegen-g-col-4">col 2/3</div>
  <div class="nijmegen-g-col-4">col 3/3</div>
</div>

Responsive

The following example has 2 columns but grows to 3 columns from medium breakpoint and above.

<div class="nijmegen-grid">
  <div class="nijmegen-g-col-6 nijmegen-g-col-md-4">.nijmegen-g-col-6 .nijmegen-g-col-md-4</div>
  <div class="nijmegen-g-col-6 nijmegen-g-col-md-4">.nijmegen-g-col-6 .nijmegen-g-col-md-4</div>
  <div class="nijmegen-g-col-6 nijmegen-g-col-md-4">.nijmegen-g-col-6 .nijmegen-g-col-md-4</div>
</div>

Starts

With start classes you can implement (responsive) starting points to the columns.

<div class="nijmegen-grid">
  <div class="nijmegen-g-col-3 nijmegen-g-start-2">start by 2 col with a 3 col width column</div>
  <div class="nijmegen-g-col-4 nijmegen-g-start-6">.start by 6 col with a 4 col width column</div>
</div>

Other

Auto columns and nesting are also supported, please check the Bootstrap v5.3 documentation for details.

Spacing

Spacing is a responsive wrapper for setting margin-inline-start, margin-inline-end, padding-inline-start and padding-inline-end values on elements based on the Bootstrap v5.3 spacing utility api. The api has generated custom (responsive) classes with the following notation nijmegen-{{property}{side}{breakpoint}-{size}.

{property} options:

  • margin-inline, horizontal margin
  • padding-inline, horizontal padding
  • margin-block, vertial margin
  • padding-block, horizontal padding

{side} options:

  • -start
  • -end
  • blank, for using both sides

{breakpoint} options:

  • -sm
  • -md
  • -lg
  • -xl
  • -xxl
  • blank, used in all viewports

{size} options:

  • 0
  • 12
  • 25
  • 50
  • 75
  • 100
  • 125
  • 150
  • 200
  • 250
  • 300
  • 400
  • 500
  • 600

By default the !important statement is added to all spacing ultilities to make sure the correct spacings are forced added if the classes are set. You can disable this by changing the following Sass variable and recompile the layout.scss file.

$nijmegen-enable-important-utilities-on-spacing: false;

Design tokens

Design tokenDefault valueSass variableCss variable
nijmegen.space.00map.set($nijmegen-space, "0", $new-value);var(--nijmegen-space-0)
nijmegen.space.120.125remmap.set($nijmegen-space, "12", $new-value);var(--nijmegen-space-12)
nijmegen.space.250.25remmap.set($nijmegen-space, "25", $new-value);var(--nijmegen-space-25)
nijmegen.space.500.5remmap.set($nijmegen-space, "50", $new-value);var(--nijmegen-space-50)
nijmegen.space.750.75remmap.set($nijmegen-space, "75", $new-value);var(--nijmegen-space-75)
nijmegen.space.1001remmap.set($nijmegen-space, "100", $new-value);var(--nijmegen-space-100)
nijmegen.space.1251.25remmap.set($nijmegen-space, "125", $new-value);var(--nijmegen-space-125)
nijmegen.space.1501.5remmap.set($nijmegen-space, "150", $new-value);var(--nijmegen-space-150)
nijmegen.space.2002remmap.set($nijmegen-space, "200", $new-value);var(--nijmegen-space-200)
nijmegen.space.2502.5remmap.set($nijmegen-space, "250", $new-value);var(--nijmegen-space-250)
nijmegen.space.3003remmap.set($nijmegen-space, "300", $new-value);var(--nijmegen-space-300)
nijmegen.space.4004remmap.set($nijmegen-space, "400", $new-value);var(--nijmegen-space-400)
nijmegen.space.5005remmap.set($nijmegen-space, "500", $new-value);var(--nijmegen-space-500)
nijmegen.space.6006remmap.set($nijmegen-space, "600", $new-value);var(--nijmegen-space-600)

Horizontal centering

The .nijmegen-margin-inline-auto class is available for horizontally centering for content that has display: block and a width set.

<div class="nijmegen-margin-inline-auto" style="width: 200px;">Vertically centered element</div>

Examples

<div class="nijmegen-margin-inline-start-25">start 0.25rem margin</div>

<div class="nijmegen-margin-inline-end-250">end 2.5rem margin</div>

<div class="nijmegen-margin-inline-300">horizonal 3rem margin</div>

<div class="nijmegen-padding-inline-500">horizontal 5rem padding</div>

<div class="nijmegen-margin-block-start-0">vertical 0 margin</div>

<div class="nijmegen-margin-block-end-75">vertical end 0.75rem margin</div>

<div class="nijmegen-margin-block-300">vertical 3rem margin</div>

<div class="nijmegen-padding-block-600">vertical 6rem padding</div>

Customization

It is possible to use your onw values based on the previous mentioned design tokens. Most of the design tokens have a CSS variable option for customization but some tokens can only be customizated by using the Sass variables. For example, the breakpoints are used in media queries so customization is only possible via loading your design tokens sass file and compile the layout.scss file to your custom css file. Use of the css variable option var() is not possible because this function can only be used to set a value on a property of an element, see W3 docs.

Example via Sass variables

custom.scss:

@import "~gemeentenijmegen/layout-css/src/layout";

// import or write your variables
@import "~gemeentenijmegen/design-tokens/dist/variables

For example by using Rollup

rollup.config.mjs:

export default {
  input: "custom.scss",
  output: {
    file: "dist/my-layout.css",
    format: "esm",
  },
};

Now run:

rollup -c

Example via CSS var()

<!doctype html>
<html lang="nl">
  <head>
    <title>Example page</title>
    <link rel="stylesheet" href="node_modules/@gemeentenijmegen/layout-css/dist/layout.min.css" />
    <!-- load your custom design tokens -->
    <link rel="stylesheet" href="node_modules/@gemeentenijmegen/design-tokens/dist/index.css'" />
    <!-- or write them in your own "theme" following NL Design System standards -->
    <style>
      .my-theme {
        --nijmegen-space-inline-0: 0.5rem;
      }
    </style>
  </head>
  <body>
    <div class="nijmegen-theme">
      <div class="nijmegen-padding-inline-0">0rem horizontal padding</div>
    </div>
    <div class="my-theme">
      <div class="nijmegen-padding-inline-0">0.5rem horizontal padding</div>
    </div>
  </body>
</html>

License

Distributed under the EUPL v1.2 License.

版本与发布记录

@gemeentenijmegen/layout-css 共发布 142 个版本,首次发布于 2025/04/10;过去 12 个月发布了 91 个版本。

版本发布日期距今
0.1.23latest2026/11/123 天前
0.1.222026/11/114 天前
0.1.212026/11/114 天前
0.1.202026/11/105 天前
0.1.192026/11/105 天前
0.1.182026/11/105 天前

关于 @gemeentenijmegen/layout-css 的常见问题

@gemeentenijmegen/layout-css 是什么?

CSS layout for a design system based on the NL Design System architecture

如何安装 @gemeentenijmegen/layout-css?

在项目目录运行 npm install @gemeentenijmegen/layout-css,或使用 pnpm add / yarn add / bun add。

@gemeentenijmegen/layout-css 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/gemeentenijmegen__layout-css 是否存在。

@gemeentenijmegen/layout-css 可以商用吗?

@gemeentenijmegen/layout-css 使用 EUPL-1.2 许可。声明的许可为 EUPL-1.2,请阅读许可原文确认使用条件。以上为概括,不构成法律意见,请以许可原文为准。

@gemeentenijmegen/layout-css 的下载量有多少?

根据 npm 官方下载统计,@gemeentenijmegen/layout-css 在 2026/10/16 – 2026/11/14 这 30 天内被下载 2,368 次,日均约 79 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@gemeentenijmegen/layout-css 还在维护吗?

最新版本 0.1.23 发布于 2026/11/12(3 天前);至今共发布 142 个版本,其中过去 12 个月发布了 91 个;首次发布于 2025/04/10。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。