Heading

Heading is used to create various levels of typographic hierarchies.

installyarn add @react-spectrum/typography
version3.0.0-alpha.1
usageimport {Heading} from '@react-spectrum/typography'

Example#


<Heading>Edit</Heading>
<Heading>Edit</Heading>
<Heading>Edit</Heading>

Content#


View guidelines

Heading is a Typography component which is a child to other components. Heading provides hierarchical information, like a title within a Dialog, based on placement within a parent component. Based on the component Heading is used within, it gets Spectrum styling and may have a preassigned slot for positioning. By virtue of its name, the Heading component provides semantic meaning in the context they are placed. Examples of their usage in Dialog and IllustratedMessage. It is important to note that the Heading component accepts any renderable node, not just strings.

See the MDN docs for more information.

Props#


NameTypeDefaultDescription
childrenReactNodeHeading content
UNSAFE_classNamestring
UNSAFE_styleCSSProperties
Layout
NameTypeDefaultDescription
flexstringnumberboolean
flexGrownumber
flexShrinknumber
flexBasisnumberstring
alignSelf'auto' | 'normal' | 'start' | 'end' | 'flex-start' | 'flex-end' | 'self-start' | 'self-end' | 'center' | 'stretch'
justifySelf'auto' | 'normal' | 'start' | 'end' | 'flex-start' | 'flex-end' | 'self-start' | 'self-end' | 'center' | 'left' | 'right' | 'stretch'
flexOrdernumber
gridAreastring
gridColumnstring
gridRowstring
gridColumnStartstring
gridColumnEndstring
gridRowStartstring
gridRowEndstring
slotstring"heading"A slot to place the heading in.
Spacing
NameTypeDefaultDescription
marginDimensionValue
marginTopDimensionValue
marginLeftDimensionValue
marginRightDimensionValue
marginBottomDimensionValue
marginStartDimensionValue
marginEndDimensionValue
marginXDimensionValue
marginYDimensionValue
Sizing
NameTypeDefaultDescription
widthDimensionValue
minWidthDimensionValue
maxWidthDimensionValue
heightDimensionValue
minHeightDimensionValue
maxHeightDimensionValue
Positioning
NameTypeDefaultDescription
position'static' | 'relative' | 'absolute' | 'fixed' | 'sticky'
topDimensionValue
bottomDimensionValue
leftDimensionValue
rightDimensionValue
startDimensionValue
endDimensionValue
zIndexnumber
isHiddenboolean
Accessibility
NameTypeDefaultDescription
idstring