Getting started
Sizes and Spacing
How sizes and spacing are defined and used in Designsystemet.
Component Sizes
Most components in Designsystemet come in three recommended sizes: Small, Medium, and Large (sm, md, lg).
These are developed to adapt to different needs across screen sizes and use cases.
Small is ideal for compact interfaces where space utilization is important, such as on mobile devices, expert tools, or administrative interfaces.
Body text is 16px in this size.
Medium is the default and suits most common use cases. Body text is 18px in this size.
This size provides a good balance between readability and space utilization and is particularly well-suited for desktop interfaces and larger display surfaces.
Large provides increased readability and clarity. It can be used in desktop interfaces or when visibility and accessibility are important. It can also be used in a defined context on the page to highlight key elements.
Body text is 21px in this size.
You choose a size with the data-size attribute. The size applies to the element and everything inside it, and changes the text size, the components and the spacing. Without data-size, Medium is used.
<div data-size="sm">
<!-- Everything in here is Small -->
</div>
The pixel values on this page apply to the default theme values and the browser's default font size (16px). The sizes are calculated in rem, so they follow the font size the user has chosen.
Components within a specific size are designed to work together.
For example, many medium components have a minimum height of 48px and 18px text, which ensures a harmonious visual balance when placed next to each other.
- Medium
- Large
To maintain a coherent and clear design, it is recommended to use fixed sizes within a given website or context. Many different combinations of sizes can lead to a cluttered and confusing design.
In some cases, components of different sizes can be combined to create better visual hierarchies and user-friendliness. In the example above, the search field section is larger and more prominent than the components in the header, because the search function is a central part of the page. The increased size makes it more visible and easily accessible to the user.
Edit this page on github.com (opens in a new tab)