Skip to main content
Brand and assets
Build
Monitor and contribute
/
Component library
  • All components
  • Buttons & actions
  • Forms & inputs
  • Layout & containers
  • Overlays
  • Feedback & status
  • Data display
  • Typography
    • A
    • AnimatedTypography
    • Code
    • Em
    • FormattedText
    • Heading
    • Highlight
    • List
    • Paragraph
    • Strike
    • Strong
    • Text
  • Accessibility
  • Contrib
  • Deprecated
  • Typography
  • Heading

Heading

Page and section headings, matching the HTML ones. Wrap them in `Section` so the levels stay right when components nest.

Health
Component health
Source
View on Github
Design
View Figma
Playground
No Example
Accessibility

compliant

Platform
Universal
  • Overview
  • Props
  • Figma
tip

Use the Section component to automatically manage heading levels in your component hierarchy. It ensures proper semantic HTML structure, improves accessibility for screen reader users, and eliminates the mental overhead of manually tracking heading levels across nested components.

Usage​

Heading 1

Heading 2

Heading 3

Size​

You can change Heading's size independently of its level:

  • If you only set the level, it will automatically deduce the size
  • If you also specify the size, it will use that value instead
Medium heading with h5 semantics

Accessibility​

More details in the dedicated section Headings.

Testing with VoiceOver​

On macOS, activate VoiceOver (Cmd + F5) And navigate to the next or previous heading using Ctrl + Option + Cmd + H and Ctrl + Option + Cmd + Shift + H, respectively.

Playground​

Loading...
tip
This component is universal, its usage is the same in murray and murray/mobile.

Heading props

NameTypeDefault ValueDescriptionUsage count
align
9 possibilities"unset""left""right""end""start""auto""center""justify"undefined
aria-disabledbooleanundefined
aria-labelstringundefined
aria-levelnumberundefinedHeading level when paired with `role="heading"`.
asChild
5 possibilitiesboolean"web""except-style""except-style-web"undefined
classNamestringundefined
color
4 possibilitiesundefined`$${string}`Variable<any>OpaqueColorValue
Color prop accepts Tamagui color tokens, ColorTokens, or dynamic token strings. Examples: "$grey900", "$indigo500", "$white", or dynamically constructed tokens like `$${name}900`
dir"auto"Directionundefined
ellipsizeMode"head""middle""tail""clip"undefined
fontFamilyFontTokensundefined
htmlForstringundefined
idstringundefined
italicbooleanundefined
langLocaleOrLanguageundefined
level
7 possibilities"h1""h2""h3""h4""h5""h6"undefined
Hierarchical level of the heading
maxFontSizeMultipliernumbernullundefined
numberOfLinesnumberundefined
onFocusundefinedFocusEventHandler<HTMLDivElement>
onKeyDown((e: KeyboardEvent) => void)undefined
onLayout((e: LayoutChangeEvent) => void)undefined
onPress
3 possibilities((event: GestureResponderEvent) => void)nullundefined
onTextLayout
2 possibilitiesundefined(e: NativeSyntheticEvent<TextLayoutEventData>) => void
Fires on mobile with the list of rendered lines. Passes through to the underlying RN Text.
roleRoleundefined
size*
7 possibilities"xs""sm""md""lg""xl""xxl"MediaProps<"xs" | "sm" | "md" | "lg" | "xl" | "xxl">
Visual size Use design tokens to set the font size and line height. - `xs` (16px / 24px) - `sm` (18px / 28px) - `md` (24px / 32px) - `lg` (32px / 40px) - `xl` (40px / 48px) - `xxl` (56px / 64px)
sx
2 possibilitiesundefinedOmit<TextProps, "fontStyle" | "fontFamily" | "fontWeight">
tabIndexstringnumberundefined
transform
6 possibilities"none""capitalize""uppercase""lowercase""unset"undefined
weightTextWeightundefined

Undocumented props

NameTypeDefault ValueDescriptionUsage count
cssany
onClickany

Style API​

Use sx for one-off adjustments. It accepts these style keys:

accessibilityActionsaccessibilityElementsHiddenaccessibilityHintaccessibilityIgnoresInvertColorsaccessibilityLabelaccessibilityLabelledByaccessibilityLanguageaccessibilityLargeContentTitleaccessibilityLiveRegionaccessibilityRespondsToUserInteractionaccessibilityRoleaccessibilityShowsLargeContentVieweraccessibilityStateaccessibilityValueaccessibilityViewIsModalaccessibleadjustsFontSizeToFitalignContentalignItemsalignSelfallowFontScalingandroid_hyphenationFrequencyanimateOnlyanimatePresenceanimationaria-busyaria-checkedaria-disabledaria-expandedaria-hiddenaria-labelaria-labelledbyaria-livearia-modalaria-selectedaria-valuemaxaria-valueminaria-valuenowaria-valuetextasChildaspectRatiobackdropFilterbackfaceVisibilitybackgroundbackgroundAttachmentbackgroundBlendModebackgroundClipbackgroundColorbackgroundImagebackgroundOriginbackgroundPositionbackgroundRepeatbackgroundSizeblockSizeborderBlockColorborderBlockEndColorborderBlockEndStyleborderBlockEndWidthborderBlockStartColorborderBlockStartStyleborderBlockStartWidthborderBlockStyleborderBlockWidthborderBottomColorborderBottomEndRadiusborderBottomLeftRadiusborderBottomRightRadiusborderBottomStartRadiusborderBottomWidthborderColorborderCurveborderEndColorborderEndEndRadiusborderEndStartRadiusborderEndWidthborderImageborderInlineColorborderInlineEndColorborderInlineEndStyleborderInlineEndWidthborderInlineStartColorborderInlineStartStyleborderInlineStartWidthborderInlineStyleborderInlineWidthborderLeftColorborderLeftWidthborderRadiusborderRightColorborderRightWidthborderStartColorborderStartEndRadiusborderStartStartRadiusborderStartWidthborderStyleborderTopColorborderTopEndRadiusborderTopLeftRadiusborderTopRightRadiusborderTopStartRadiusborderTopWidthborderWidthbottomboxShadowboxSizingcaretColorchildrenclassNameclipPathcolorcolumnGapcomponentNamecontaincontainerTypecontentcursordangerouslySetInnerHTMLdataDetectorTypedebugdirectiondisableClassNamedisableOptimizationdisableddisabledStyledisplaydynamicTypeRampelevationellipseellipsizeModeendenterStyleexitStyleexperimental_backgroundImageexperimental_backgroundPositionexperimental_backgroundRepeatexperimental_backgroundSizefilterflexflexBasisflexDirectionflexGrowflexShrinkflexWrapfloatfocusStylefocusVisibleStylefocusWithinStylefontSizefontVariantfontVariationSettingsforceStylegapgridColumngridColumnEndgridColumnGapgridColumnStartgridRowgridRowEndgridRowGapgridRowStartgridTemplateAreasgridTemplateColumnsgroupheighthitSlophoverStylehtmlForidimportantForAccessibilityincludeFontPaddinginlineSizeinsetinsetBlockinsetBlockEndinsetBlockStartinsetInlineinsetInlineEndinsetInlineStartisolationjustifyContentleftletterSpacinglineBreakModelineBreakStrategyIOSlineHeightmarginmarginBlockmarginBlockEndmarginBlockStartmarginBottommarginEndmarginHorizontalmarginInlinemarginInlineEndmarginInlineStartmarginLeftmarginRightmarginStartmarginTopmarginVerticalmaskmaskBordermaskBorderModemaskBorderOutsetmaskBorderRepeatmaskBorderSlicemaskBorderSourcemaskBorderWidthmaskClipmaskCompositemaskImagemaskModemaskOriginmaskPositionmaskRepeatmaskSizemaskTypematrixmaxBlockSizemaxFontSizeMultipliermaxHeightmaxInlineSizemaxWidthminBlockSizeminHeightminInlineSizeminWidthminimumFontScalemixBlendModenativeIDnumberOfLinesobjectFitonAccessibilityActiononAccessibilityEscapeonAccessibilityTaponBluronFocusonHoverInonHoverOutonLongPressonMagicTaponMouseDownonMouseEnteronMouseLeaveonMouseUponPressonPressInonPressOutopacityoutlineColoroutlineOffsetoutlineStyleoutlineWidthoverflowoverflowBlockoverflowInlinepaddingpaddingBlockpaddingBlockEndpaddingBlockStartpaddingBottompaddingEndpaddingHorizontalpaddingInlinepaddingInlineEndpaddingInlineStartpaddingLeftpaddingRightpaddingStartpaddingToppaddingVerticalpassThroughperspectivepointerEventspositionpressRetentionOffsetpressStylerightrolerotaterotateXrotateYrotateZrotationrowGapscalescaleXscaleYscreenReaderFocusablescrollbarWidthselectableselectionColorseparatorshadowColorshadowOffsetshadowOpacityshadowRadiusskewXskewYspacespaceDirectionstartstylesuppressHighlightingtabIndextagtargettestIDtextAligntextAlignVerticaltextBreakStrategytextDecorationColortextDecorationDistancetextDecorationLinetextDecorationStyletextEmphasistextOverflowtextShadowColortextShadowOffsettextShadowRadiustextTransformtextWrapthemethemeInversethemeShallowtoptouchActiontransformtransformMatrixtransformOrigintransformStyletransitiontranslateXtranslateYuntilMeasureduserSelectverticalAlignwhiteSpacewidthwordWrapwritingDirectionxyzIndex

Each can be overridden per breakpoint with:

$group-focus$group-focusVisible$group-focusWithin$group-hover$group-lg$group-lg-focus$group-lg-focusVisible$group-lg-focusWithin$group-lg-hover$group-lg-press$group-ltLg$group-ltLg-focus$group-ltLg-focusVisible$group-ltLg-focusWithin$group-ltLg-hover$group-ltLg-press$group-ltMd$group-ltMd-focus$group-ltMd-focusVisible$group-ltMd-focusWithin$group-ltMd-hover$group-ltMd-press$group-ltSm$group-ltSm-focus$group-ltSm-focusVisible$group-ltSm-focusWithin$group-ltSm-hover$group-ltSm-press$group-ltVs$group-ltVs-focus$group-ltVs-focusVisible$group-ltVs-focusWithin$group-ltVs-hover$group-ltVs-press$group-ltXl$group-ltXl-focus$group-ltXl-focusVisible$group-ltXl-focusWithin$group-ltXl-hover$group-ltXl-press$group-ltXxl$group-ltXxl-focus$group-ltXxl-focusVisible$group-ltXxl-focusWithin$group-ltXxl-hover$group-ltXxl-press$group-md$group-md-focus$group-md-focusVisible$group-md-focusWithin$group-md-hover$group-md-press$group-press$group-sm$group-sm-focus$group-sm-focusVisible$group-sm-focusWithin$group-sm-hover$group-sm-press$group-vs$group-vs-focus$group-vs-focusVisible$group-vs-focusWithin$group-vs-hover$group-vs-press$group-xl$group-xl-focus$group-xl-focusVisible$group-xl-focusWithin$group-xl-hover$group-xl-press$group-xs$group-xs-focus$group-xs-focusVisible$group-xs-focusWithin$group-xs-hover$group-xs-press$group-xxl$group-xxl-focus$group-xxl-focusVisible$group-xxl-focusWithin$group-xxl-hover$group-xxl-press$lg$ltLg$ltMd$ltSm$ltVs$ltXl$ltXxl$md$platform-android$platform-ios$platform-native$platform-web$sm$vs$xl$xs$xxl
Edit this page
Previous
FormattedText
Next
Highlight
  • Usage
  • Size
  • Accessibility
    • Testing with VoiceOver
  • Playground