Text
Learn how to change the text size, alignment, and font-weight.
Typeface
We use the Roboto font family by Google. Add this line to the <head> of your widgets to use this font:
<link href="https://fonts.googleapis.com/css?family=Roboto:400,400i,700,700i" rel="stylesheet">
Font Size
The base font size is 16px. It's applied by default.
Note, that if an element doesn't have a class it inherits all font properties from its parent. This means that you can add a class once, and it will be applied to all child elements (if they don't have a class that overrides the parent class).
Use these classes to change the font size:
| CSS Class | Font Size / Line Height |
|---|---|
.text-sm | 12px / 16px |
.text-md | 14px / 20px |
.text-lg | 16px / 24px |
.h3 | 20px / 28px |
.h2 | 24px / 32px |
.h1 | 28px / 36px |
.h0 | 36px / 44px |
.title2 | 48px / 56px |
.title1 | 60px / 68px |
Font Weight, Decoration, and Alignment
| CSS Class | Result |
|---|---|
.text-bold | Bold text |
.text-normal | Normal text (default) |
.text-underline | Underlined text |
.text-italic | Italic text |
.text-left | Left-aligned text (default) |
.text-center | Center-aligned text |
.text-right | Right-aligned text |
You can also use responsive alignment.
Example: text with .text-center.text-md-left.text-lg-right.text-xl-center classes will be center-aligned on screens up to 679px, left-aligned on screens up to 879px, right-aligned on screens up to 1179px, and center-aligned on larger screens.
Text Wrapping & Truncation
| CSS Class | Result |
|---|---|
.text-wrap | Very long text that wraps words (default behaviour) |
.text-wrap-all | Very long text that wraps letters |
.text-nowrap | Very long text that don't wrap |
.text-keep-newlines | Keeps the line breaks from the source text (for example user-entered text), while still wrapping long lines. |
.text-truncate |
Text that truncates if there's not enough space, so this long sentence ends with an ellipsis instead of wrapping to the next line. Text that truncates if there's not enough space. Please note that it must be placed in a container that has an |
.line-clamp-{1–10} |
Text limited to two lines with Limits text to 1–10 lines and adds an ellipsis. Unlike |
Lists & Paragraphs
By default text paragraphs (<p>) don't have bottom margins. You can add them manually by using .mb-8 or similar classes.
| CSS Class | Effect | Result |
|---|---|---|
ul.list-unstyledol.list-unstyled |
Removes bullet points from the list |
|
ul.list-inlineol.list-inline |
Produces inline list (implicitly makes a flex layout) |
|
.list-disc |
Restores solid bullets on a nested list (browsers switch nested lists to hollow circles) |
|
li.list-item-unstyled |
Removes the bullet from an <li> that isn't inside a <ul> or <ol>, e.g. a dragged list item |
Used inside components (not shown) |
Links
Links use the theme's link color (--link-color). Keyboard users see a focus ring around a focused link.
| CSS Class | Effect | Result |
|---|---|---|
a.link-unstyled |
Removes link styling completely | Unstyled link |
.underline-links |
Underlines every link inside the element. The app sets it on <html>, as this styleguide does |
Underlined link |
a.inset-focus-indicator |
Draws the keyboard focus ring inside the link instead of around it, for links that fill a clipped container. Press Tab to see it | Inset focus ring |
Highlights & Other Elements
| Element | Effect | Result |
|---|---|---|
mark.mark-highlight |
Yellow highlight, e.g. for search matches | Search for design tokens |
mark.mark-bold |
Marks text in bold without a background | Search for design tokens |
kbd |
Keyboard key | Press Ctrl + K |
hr |
Divider line in the border color | Content above Content below |