Skip to main content

Heading

Creates appropriately sized and nested heading elements.

github
View source code

Migration Information

For teams migrating from the V1 to V2 component, please refer to the migration guide for changes to the component.
Component Guide
import { Heading } from '@uhg-abyss/web/ui/Heading';

Usage​

The Heading component is used to create headings in your application. It supports different levels, sizes, and styles based on the brand (Optum or UHC). It follows our Typography guidelines to ensure consistency across the application.

Level​

If you want to set the heading level, you can provide a level prop. This will allow you to set a specific heading level (1-6). The default is 1.

Size​

The size prop controls the visual size of the heading typography.

  • Optum: 'xxl' | 'xl' | 'lg' | 'md' | 'sm' | 'xs' | 'xxs'

The default is xl.

Color​

Use the color prop to set the color of the text. This prop accepts any valid CSS color identifier (RGB, HSL, named color, etc.) as well as Abyss color tokens. The default value is '$web.semantic.color.text.content.primary'.

Color contrast

Text colors must meet the minimum 3:1 contrast ratio for large text as per WCAG 2.1 guidelines.

Text alignment​

Use the textAlign prop to control the horizontal alignment of the heading text. Available values are 'left', 'center', and 'right'. The default alignment is 'left'.

Nesting heading levels​

Using Heading.Level​

Nesting headers with the Heading.Level subcomponent allows users to have multiple levels of headers, without having to directly tag each level of <h*> tags. It also automatically adjusts the size.

Using level and size​

Alternatively, users can set the level and size props on a Heading to achieve the same effect.

Nesting example​

Nested headers can be combined together with text to organize sections and create a seamless document experience.

Heading Props​

NameTypeDefaultRequiredDescription
children
React.ReactNode
-
The heading content to display
color
string | undefined
'$web.semantic.color.text.content.primary'
-
The color of the heading
display
false | true | never | undefined
--
Whether to use Display typography (UHC only) Display mode not available for Optum
level
1 | 2 | 3 | 4 | 5 | 6 | undefined
1
-
What level heading to display
serif
boolean | true | never | undefined
false
-
Whether the heading should be serif or sans serif (UHC only) Serif not available for Optum
size
'xl' | 'lg' | 'md' | 'sm' | 'xs' | 'lg' | 'md' | 'sm' | 'xxl' | 'xl' | 'lg' | 'md' | 'sm' | 'xs' | 'xxs' | undefined
'xl'
-
The visual size of the heading The visual size of the heading (limited for display mode)
textAlign
'left' | 'center' | 'right' | undefined
--
The text alignment of the heading

Below are the link(s) to the relevant GitHub type files:

Abyss.d.ts

Heading Classes​

Class NameDescription
.abyss-heading-rootThe heading root element
Table of Contents