Typography
The Typography component provides a reusable pattern for typography in the interface.
Variant
In this case, variant is set to h1 and element parameter is left untouched. This results in a <p> element that looks like h5 element.
Variant h1
Element
When the parameter element is set and the variant element is not, the result is a p element that looks like a <h1> element.
Element h1
Heading Variants
Standard HTML heading levels from h1 to h6. These are semantic elements that define the document structure and hierarchy.
Variant: h1
Variant: h2
Variant: h3
Variant: h4
Variant: h5
Variant: h6
Display Variants
Large display text variants including headline, title, and subtitle. These are used for prominent text that needs visual emphasis.
Body Text Variants
Standard body text variants including body, paragraph (p), and bold. These are the primary text styles for content.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec suscipit auctor dui, a efficitur ligula. Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec suscipit auctor dui, a efficitur ligula. Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec suscipit auctor dui, a efficitur ligula. Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec suscipit auctor dui, a efficitur ligula. Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla.
Small Text Variants
Smaller text variants including caption, byline, and meta. These are used for secondary information and annotations.
Specialized Variants
Specialized text variants for specific use cases such as marketing and email content.
API
| Parameter | Default | Description |
|---|---|---|
|
element
|
p | What element the markup will use. |
|
variant
|
false | Headings (h1, h2...) can only be set to other headings. If left empty it will default to the given element. |
|
slot
|
The content | |
|
autopromote
|
false | Upgrade element to h1 (from h3 and above), if seen first on page. |
|
useHeadingsContext
|
true | If a heading should be based off of the context its in. |
CSS API
| Variable | Default | Type | Values | Description |
|---|---|---|---|---|
|
--c-typography--font-family-base
|
var(--font-family-base) | font | - | Body Font |
|
--c-typography--font-family-heading
|
var(--font-family-heading) | font | - | Falls back to body font if not set. |
|
--c-typography--font-weight-normal
|
var(--font-weight-normal) | select | 100, 200, 300, 400, 500, 600 | Normal Weight |
|
--c-typography--font-weight-medium
|
var(--font-weight-medium) | select | 400, 500, 600, 700 | Medium Weight |
|
--c-typography--font-weight-bold
|
var(--font-weight-bold) | select | 600, 700, 800, 900 | Bold Weight |
|
--c-typography--font-weight-heading
|
var(--font-weight-heading) | select | 400, 500, 600, 700, 800, 900 | Heading Weight |
|
--c-typography--line-height-base
|
var(--line-height-base) | range | - | Body Line Height |
|
--c-typography--line-height-heading
|
var(--line-height-heading) | range | - | Heading Line Height |
|
--c-typography--letter-spacing-base
|
var(--letter-spacing-base) | range | - | Letter Spacing |
|
--c-typography--base-font-size
|
var(--base-font-size) | select | 16px, 18px | Root font size. All typographic sizes derive from this. |
|
--c-typography--space
|
var(--space) | range | - | Base spacing unit. Used for padding and margin inside components. |
|
--c-typography--font-size-scale-ratio
|
var(--font-size-scale-ratio) | select | 1.067, 1.125, 1.200, 1.250, 1.333 | Multiplier that generates all font sizes from the base. |
|
--c-typography--font-size-90
|
var(--font-size-90) | range | - | One step below base in the type scale. |
|
--c-typography--font-size-200
|
var(--font-size-200) | range | - | One step above base in the type scale. Equivalent to h6/subtitle. |
|
--c-typography--font-size-300
|
var(--font-size-300) | range | - | Two steps above base in the type scale. Equivalent to h5. |
|
--c-typography--font-size-400
|
var(--font-size-400) | range | - | Three steps above base in the type scale. Equivalent to h4. |
|
--c-typography--font-size-500
|
var(--font-size-500) | range | - | Four steps above base in the type scale. Equivalent to h3. |
|
--c-typography--font-size-600
|
var(--font-size-600) | range | - | Five steps above base in the type scale. Equivalent to h2. |
|
--c-typography--font-size-700
|
var(--font-size-700) | range | - | Six steps above base in the type scale. Equivalent to h1. |
|
--c-typography--font-size-800
|
var(--font-size-800) | range | - | Seven steps above base in the type scale. Larger than h1. |