Typography
Open in Storybook Open in Figma
This page describes basic font and text components. See the Typography examples for examples on how to combine them.
The typography and spacing rules given here cover the basic appearance in George. Individual components (e.g. FunctionCard) might overrule some of these rules in certain cases. In such a case, those exceptions are described in the respective component pages of GDS.
Headlines
Headlines are set using <h1>
to <h4>
elements. Not all headlines are allowed in every context:
- There is only one
<h1>
per page, serving as page title. - Exception to the initial rule: An open Modal counts as a page within a page (that traps the user inside of it), in this case the Modal title adds another
<h1>
. - Outside of George Store,
<h1>
on grey background have become obsolete, as the page title will be set in StripeHeader and Modal. - Two headlines can never follow each other directly.
<h2>
and<h3>
on grey background are used to structure main content.<h2>
,<h3>
, and<h4>
are used in cards for headlines. They all look the same. The actual level of the headline to use depends on the last headline used outside the card so that in pure text mode it is a continuation of the outer headline level.
Rules For Developers
- DEPRECATED There used to be a line after
<h1>
, but it is no longer rendered. As a result, suppressing it with.g-no-line
is not needed anymore. For the record, legacy<h1>
that are followed by<hr>
to mimick a line should be a thing of the past by now. - Apply
.g-first
to a headline if you want it to have no top margin – if it’s the first element on grey background. - There is no need to apply
.g-first
inside cards, even if the headline is the first element.
Rules For Designers
- Headlines for all levels (
<h1>
..<h6>
) use font-weight bold 700. - On grey background, …
<h1>
has a font-size of 24px with 30px line-height,<h2>
has a font-size of 22px with 28px line-height,<h3>
has a font-size of 18px with 24px line-height,<h4>
has a font-size of 18px with 20px line-height,<h5>
and<h6>
have a font-size of 16px with 20px line-height.
- Inside cards, …
<h2>
..<h6>
inside cards all have a font-size of 18px with 24px line-height.
- DEPRECATED
<h1>
used to be followed by 16px spacing, a line 1px /$color-gray-200 (#e4eaf0)
, and another 16px spacing to the following content. <h2>
..<h3>
have 20px spacing to the following content.
Paragraphs
Regular text is set using <p>
elements. Minor/smaller text is set by adding .g-small
. Micro text is set by adding .g-micro
. Faded text is set by adding .g-faded
.
HINT Do not use unstyled text, always use <p>
elements.
HINT As .g-small
also adjusts the line height, it should be used on block-level elements. <small>
elements may be used in addition inside any paragraph, and especially in those that have .g-small
applied, to mark fine print semantically. But use of these elements does not result in any visual changes (e.g. no smaller font), only .g-small
does.
HINT Avoid <br/>
and convert them to <p>
instead.
Rules For Designers
- Regular paragraphs use 16px font-size with 24px line-height.
- Small paragraphs use 14px font-size with 21px line-height.
- Text colour on both white and grey background is
$color-blue-400 (#0a285c)
. - Faded text colour on both white and grey background is
$color-gray-400 (#537091)
.
Emphasis
George uses two kinds of emphasized text: bold and ‘quoted’. Bold is used if whole sentences are important. Quotes are used, if single words or short phrases within a sentence need to be emphasized:
Rules For Copywriters
- When using quote text, the correct language-specific opening and closing quotes have to be used.
Rules For Designers
- Emphasised text elements inside components (e.g. date, title, amount in transactions, hyperlinks in paragraph text) use font-weight semi-bold 600.
- Bold text is not allowed in small paragraphs, but hyperlinks are.
Hyperlinks
Ordinary in-line hyperlinks are set using <a>
elements within <p>
elements.
Rules For Designers
- Hyperlinks are presented in semi-bold 600 /
$color-blue-300 (#135ee2)
. - Hyperlinks are underlined on hover and not otherwise.
- Hyperlinks and Buttons have a visually similar focus state.
Lists
George lists come in different flavours. The List component is used to create unordered and ordered lists (<ul>
, <ol>
). If you need a definition list (<dl>
), head over to the LabeledList component.
Variants
First and foremost, appearance of ordered and unorded lists is controlled via the variant
prop.
With bullet points
This is the default, and what you get if you explicitly set List.VARIANT.BULLETS
.
With numbers
To display numbers as indicators, use List.VARIANT.NUMBERS
. To see an example, scroll down to Ordered lists.
With checkmarks
George Store lists feature checkmarks instead of bullet points, so there you may want to set List.VARIANT.CHECKMARKS
.
Without an indicator
Plain lists (List.VARIANT.PLAIN
) have no visual indication that they are lists at all, they look identical to a sequence of paragraphs.
To completely remove styles, List.VARIANT.UNSTYLED
exists. If you additionally make a plain List more compact, the margin between list items is removed, but the unstyled variant goes one step further, as it also removes the List’s outer margin.
Lists with custom icons
Ordered lists
The List’s ordered
prop turns an unordered list (<ul>
) into an ordered one (<ul>
).
Rules For Developers
- For backwards compatibility, the
ordered
prop changes the default ofvariant
from BULLETS to NUMBERS. - But you can make any list an ordered list, including the one with bullet points, all you need to do is explicitely set a
variant
. - And vice-versa: Semantically speaking, a numbered List does not need to be ordered. But given that it will look like an ordered list visually, we recommend to always set
ordered
for Lists that haveList.VARIANT.NUMBERS
. As mentioned, this is something you get for free if you just setordered
, as shown in the example above.
Compact lists
You can add set the compact
prop, which eliminates spacing between list items.
Small and faded lists
There are even more options, you can make a List display with faded
and/or small
text.
If a List is part of legal text (i.e., a region with the .g-small
modifier applied), small
is automatically applied. In George Store, legal text is usually faded
too.
Separators
A 1px
divider line can be created using the Separator component. It comes with some spacing before & after, its size can be controlled with the spacing
prop.
When the thematicBreak
prop is set, Separator will turn into a thematic break (a.k.a. horizontal rule). To quote MDN:
The
<hr>
HTML element represents a thematic break between paragraph-level elements: for example, a change of scene in a story, or a shift of topic within a section.
This is why we only care about the visual aspect of the component, make sure to only use thematicBreak
when it makes semantic sense.
Rules For Developers
- The
spacing
prop has currently two values:REGULAR
gives you6px
before and after the Separator, and is still the default if neithercompact
norspacing
is set.INHERIT
doesn’t give you a specific value, instead it will inherit the vertical spacing of either a Card or Modal. In other words, the inherited spacing will be10px
in Cards with regular padding,32px
in Cards with large padding, and16px
in a Modal. This also means using it on grey background does not create any spacing.
- To be backwards-compatible, setting the DEPRECATED
compact
prop is still needed to remove spacing before and after. (In an upcoming major release, the prop will be removed, and you’ll be able to get no spacing by leavingspacing
undefined.) - The
protrude
prop can be set inside Card and Modal whenever the width of the Separator needs to grow so it stretches from edge to edge, i.e. to include the padding of said Card or Modal.
Variations
Variations for the aforementioned typographic building blocks exist. So when used under the following specific circumstances, you may encounter certain areas of markup with an alternate look and feel.
Tabular numbers
If you need alignment for numeric values, you can add the .g-tabular
modifier.
HINT In the example below, the dates and amounts on the left have the modifier applied; on the right without modifier for comparison.
Legal text
Sections containing legal text can be marked up with .g-small
. Legal text is presented in smaller font size. For more information check out the legal text example in our Typography examples.
Rules For Designers
- Legal text uses a smaller font, which is then inherited by
- paragraphs and lists,
- but not headlines.
Miscellaneous
Selected text
George uses native colours provided by the operating system (or web browser) for selected text.
Text spacing
Due to rem
rounding errors, spacings are usually +/-1px correct.
Rules For Designers
- Headlines, except the first one in a container, are preceded by 40px spacing.
- Paragraphs are preceded by 20px spacing.
- Lists and list items use the same vertical spacing as paragraphs.
- Separators keep 16px spacing above/below to another element (this overrules other spacing rules).