Typography
Type is a core part of any offering and critical to how brands express and communicate throughout any experience. Use the Carbon type package to leverage IBM Plex and create effective typography across your products more easily.
Usage
The
@carbon/type
h1
h2
p
You can use this package by writing the following:
@use '@carbon/type';// Include type reset@include type.reset();// Include default type styles, targets h1, h2, h3, etc@include type.default-type();// Include utility classes for type-related properties@include type.type-classes();
Type classes
The
type-classes
@mixin type-classes;
In particular, you can use the following classes:
Class | Description |
---|---|
| Set the
|
| Set the
|
| Set the
|
| Style the HTML element with the given type token |
Type styles
Instead of using a type scale,
@carbon/type
You can find a full reference of the type styles that are available on the Carbon Design System website .
You can include a token in your Sass file by writing:
@use '@carbon/type';@include type.type-style('productive-heading-01');
Reset
An optional type reset is provided under the
type.reset()
@use '@carbon/type';@include type.reset();
This reset sets some top-level properties on
html
body
font-size
font-family
text-rendering
strong
Type scale
A type scale is provided through the
$type-scale
type-scale
If you are looking to use the type scale, you can include all the scale-related utilities and variables by writing the following in your Sass file:
@use '@carbon/type';
You can access a specific step in the type scale by using the
type-scale
@use '@carbon/type';.my-selector {font-size: type.type-scale(1);}