Typography

Our system of fonts and text styles that help communicate clearly, strengthen our brand, and connect with users.

Typography is a fundamental aspect of design, playing a critical role in establishing visual hierarchy, readability, and brand identity. Our design system provides two main approaches to implementing typography in your projects:

  1. The DsText component
  2. ds-text utility classes

Each approach serves different needs depending on the context in which you're working, whether it's in a component-based environment or directly in server-rendered markup.

Which should I use and when?

Text component

The Text component is ideal for use in a component-based context. It mirrors the Text component available to designers, making it easy to translate designs into code without losing consistency.

Example usage:


                                                        
                                                        
                                                            <template>
                                                        <DsText 
                                                            htmlElement="p"
                                                            text-type="body-lg"
                                                            text-style="regular">Quisque malesuada sagittis turpis lacinia egestas... </DsText>
                                                        </template>
                                                        
                                                            

Utility classes

Use ds-text utility classes when dealing with server-rendered markup or in situations where you need to apply typography styles without mounting a component. This method is efficient for quickly applying styles in contexts where performance or simplicity is a priority. The utility classes are the same as those used by the Text component, ensuring consistency across different implementations.

Example usage:


                                                        
                                                        
                                                            <p class="ds-text-body-lg ds-text--regular"> 
                                                            Quisque malesuada sagittis turpis lacinia egestas...
                                                        </p>
                                                        
                                                            

Text types

Text types are predefined presets that control the font family, size, and line-height. These presets allow you to maintain a consistent typographic hierarchy and rhythm across your application.

Text types for page content

By default the presets are responsive and the styles will adjust to the user’s viewport size.

  • ds-text-heading-8xl
  • ds-text-heading-7xl
  • ds-text-heading-6xl
  • ds-text-heading-5xl
  • ds-text-heading-4xl
  • ds-text-heading-3xl
  • ds-text-heading-2xl
  • ds-text-heading-xl
  • ds-text-heading-lg
  • ds-text-heading-md
  • ds-text-body-xl
  • ds-text-body-lg
  • ds-text-body-md
  • ds-text-body-sm
  • ds-text-body-xs

These text types help to maintain a clear and consistent hierarchy, from large headings down to small body text.

Text types for fixed size labels

These are used for fixed-size elements and are typically used as labels or as text inside smaller UI elements, they are not intended for regular page content scenarios.

  • ds-text-label-lg
  • ds-text-label-md
  • ds-text-label-sm

Text styles

Text styles are modifiers that impact the font weight, which in turn determines the font face being used. In this context, we refer to these as "styles" rather than weights because the system may expand to include other variations, such as italics, in the future.

Available text styles:

  • ds-text--regular: Applies a regular font weight.
  • ds-text--medium: Applies a medium font weight, slightly bolder than regular.
  • ds-text--bold: Applies a bold font weight, useful for emphasising text.

By combining text types and styles, you can create a wide variety of typographic expressions while ensuring that your design remains consistent with the system's standards.