šŸš€ Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more →
Socket
Sign inDemoInstall
Socket

@gemeentenijmegen/layout-css

Package Overview
Dependencies
Maintainers
5
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gemeentenijmegen/layout-css

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

0.0.1-alpha.4
latest
Source
npm
Version published
Maintainers
5
Created
Source

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.

Keywords

nl-design-system

FAQs

Package last updated on 11 Apr 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts