Typography
Relevant links
Typography components
The two main components used to set typography are:
(Lead and Ingress also works in the same way)
Typography in general
Fonts are handled automatically once the CSS packages dnb-ui-core or dnb-ui-basis are loaded.
Every typography HTML element, like headings and paragraphs, have a defined height, respective line-height so everything falls exactly into the 8 pixel grid.
You don't need to define the font-family ever, but rather use CSS Custom Properties for font-weight, font-size and line-height.
Typography property tables
Typography Examples
Heading xx-largeDette er en heading på over to linjer
Heading x-largeOg dette er en heading small tittel som også går over to linjer, nei vent, tre linjer.
Heading largeHva har vi her, en liten heading som mot alle odds går over flere linjer.
Text LeadLorem ipsum dolor sit amet, sint quodsi concludaturque nam ei, appetere oporteat eam te.
Text basisLorem ipsum dolor sit amet, sint quodsi concludaturque nam ei, appetere oporteat eam te. Vel in deleniti sensibus, officiis menandri efficiantur no cum. Per et habemus gubergren. Mundi copiosae pertinax ea pro, vidit fierent mentitum in est, ex fabellas senserit inciderint vim.
Text basis (Medium)Lorem ipsum dolor sit amet, sint quodsi concludaturque nam ei, appetere oporteat eam te. Vel in deleniti sensibus, officiis menandri efficiantur no cum. Per et habemus gubergren. Mundi copiosae pertinax ea pro, vidit fierent mentitum in est, ex fabellas senserit inciderint vim.
Text smallLorem ipsum dolor sit amet, sint quodsi concludaturque nam ei, appetere oporteat eam te. Vel in deleniti sensibus, officiis menandri efficiantur no cum. Per et habemus gubergren. Mundi copiosae pertinax ea pro, vidit fierent mentitum in est, ex fabellas senserit inciderint vim.
Text small (Medium)Lorem ipsum dolor sit amet, sint quodsi concludaturque nam ei, appetere oporteat eam te. Vel in deleniti sensibus, officiis menandri efficiantur no cum. Per et habemus gubergren. Mundi copiosae pertinax ea pro, vidit fierent mentitum in est, ex fabellas senserit inciderint vim.
Text x-smallLorem ipsum dolor sit amet, sint quodsi concludaturque nam ei.
Text x-small (Medium)Lorem ipsum dolor sit amet, sint quodsi concludaturque nam ei.
Font Face
The default DNB font family is DNB, loaded via @font-face in @dnb/eufemia/src/style/themes/theme-ui/fonts.scss.
- Sbanken uses its own fonts, declared and loaded in
@dnb/eufemia/src/style/themes/theme-sbanken/fonts.scssand applied via Sbanken-specific properties. - Carnegie uses the
ArizonaFlarefont family, declared and loaded in@dnb/eufemia/src/style/themes/theme-carnegie/fonts.scss, and applied through the Carnegie theme’s typography variables. - Eiendom uses the default DNB font family.
Spacing and margin collapsing
You can use the Spacing properties inside every Eufemia React Element, but keep in mind, margin collapsing can some times a little tricky to get right.
import { H1, H2, ... } from '@dnb/eufemia'<H1 bottom="x-large">Heading with bottom margin: x-large</H1><H2 top="x-large">Heading with top margin: x-large</H2>
Anchor
.dnb-anchorAnchor with default style.dnb-anchor--hoverHover Style.dnb-anchor--activeActive Style.dnb-anchor--focusFocus Style
Read more about the Anchor / Text Link
DNB Mono (monospace)
DNB has its own monospace typeface (font-family).
Use it either by a CSS class .dnb-t__family--monospace or define your own like so:
.css-selector {font-family: var(--font-family-monospace);font-weight: normal;font-style: normal;}
Hosted Fonts (CDN)
The font files are hosted under the following URLs:
DNB
https://eufemia.dnb.no/fonts/dnb/DNB-Regular.woff2https://eufemia.dnb.no/fonts/dnb/DNB-Medium.woff2https://eufemia.dnb.no/fonts/dnb/DNB-Bold.woff2https://eufemia.dnb.no/fonts/dnb/DNBMono-Regular.woff2https://eufemia.dnb.no/fonts/dnb/DNBMono-Medium.woff2https://eufemia.dnb.no/fonts/dnb/DNBMono-Bold.woff2
Sbanken
https://eufemia.dnb.no/fonts/sbanken/MaisonNeue.woff2https://eufemia.dnb.no/fonts/sbanken/Roboto-Regular.woff2https://eufemia.dnb.no/fonts/sbanken/Roboto-Medium.woff2https://eufemia.dnb.no/fonts/sbanken/Roboto-Bold.woff2
DNB Carnegie
https://eufemia.dnb.no/fonts/carnegie/ArizonaFlare-Regular.woff2https://eufemia.dnb.no/fonts/carnegie/ArizonaFlare-Medium.woff2https://eufemia.dnb.no/fonts/carnegie/ArizonaFlare-Bold.woff2