Skip to main content
Brand and assets
Build
Monitor and contribute
/
Component library
  • All components
  • Buttons & actions
  • Forms & inputs
  • Layout & containers
    • Anchors
    • Box
    • Col
    • Container
    • ContainerNext
    • FullPageLayout
    • Grid
    • HStack
    • Header
    • Header
    • LayoutGrid
    • Navigation
    • Pagination
    • Row
    • Section
    • Spacer
    • TabList
    • TabList
    • Tabs
    • VStack
  • Overlays
  • Feedback & status
  • Data display
  • Typography
  • Accessibility
  • Contrib
  • Deprecated
  • Layout & containers
  • Section

Section

Renders a `<section>` and works out the right heading level for the headings inside it. Use so nesting a component never breaks the page outline.

Health
Component health
Source
View on Github
Playground
No Example
Accessibility

compliant

Platform
Universal
  • Overview
  • Props

The Section component is a semantic wrapper that automatically manages heading levels within nested sections. By default it renders a <section> HTML element on the Web platform, but can render <article>, <aside>, or <nav> using the tag prop. It provides a context that increments the heading level for any Heading components used inside.

Usage​

Section Title

Automatic Heading Level Management​

When you nest Section components, the heading level is automatically incremented. This ensures proper document structure without manually tracking heading levels.

Main Section

Nested Section

Deeply Nested Section

In the example above:

  • The outer Section sets heading level to h1
  • The first nested Section increments to h2
  • The deeply nested Section increments to h3

Using Different HTML Sectioning Elements​

Web Platform Only

The tag prop is only used on the web platform. On React Native, the Section component always renders a View regardless of the tag value, as native platforms don't have semantic HTML elements.

Use the tag prop to render different HTML sectioning elements while maintaining automatic heading level management:

Page Title

Article Section

Self-contained content using tag="article"

Aside Section

Supplementary content using tag="aside"

Nav Section

Navigation content using tag="nav"

ValueHTML ElementUse Case
section<section>Generic standalone section of a document that doesn't have a more specific semantic element to represent it (default). MDN
article<article>Self-contained composition intended to be independently distributable or reusable (e.g., blog post, comment, forum post). MDN
aside<aside>Content indirectly related to the main content (e.g., sidebars, pull quotes, advertising, related links). MDN
nav<nav>Section providing navigation links (e.g., menus, tables of contents, indexes). MDN

Accessibility​

The Section component helps maintain proper heading hierarchy, which is essential for:

  • Screen readers: Users can navigate through the document using heading shortcuts
  • Document outline: Creates a logical structure that assistive technologies can interpret
  • WCAG compliance: Aligns with WCAG 2.1 guideline 1.3.1 for proper information structure

More details in the dedicated section Headings.

Do​

Use Section to structure your content and let heading levels be managed automatically:

Article Title

Introduction paragraph...

First Section

Content for this section...

Second Section

More content...

Don't​

Don't manually manage heading levels when you can use Section:

Article Title

Introduction paragraph...

First Section

Content for this section...

Second Section

More content...

Playground​

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

Section props

NameTypeDefault ValueDescriptionUsage count
initialLevelHeadingLevelundefined
sxStackStyleundefined
tag
5 possibilities"article""aside""nav""section"undefined
sectionControls the output tag on web {@see https://developer.mozilla.org/en-US/docs/Web/HTML/Element}

Style API​

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

alignContentalignItemsalignSelfanimateOnlyanimatePresenceanimationaspectRatiobackdropFilterbackfaceVisibilitybackgroundbackgroundAttachmentbackgroundBlendModebackgroundClipbackgroundColorbackgroundImagebackgroundOriginbackgroundPositionbackgroundRepeatbackgroundSizeblockSizeborderBlockColorborderBlockEndColorborderBlockEndStyleborderBlockEndWidthborderBlockStartColorborderBlockStartStyleborderBlockStartWidthborderBlockStyleborderBlockWidthborderBottomColorborderBottomEndRadiusborderBottomStartRadiusborderBottomWidthborderColorborderCurveborderEndColorborderEndEndRadiusborderEndStartRadiusborderEndWidthborderImageborderInlineColorborderInlineEndColorborderInlineEndStyleborderInlineEndWidthborderInlineStartColorborderInlineStartStyleborderInlineStartWidthborderInlineStyleborderInlineWidthborderRadiusborderStartColorborderStartEndRadiusborderStartStartRadiusborderStartWidthborderStyleborderTopColorborderTopEndRadiusborderTopStartRadiusborderTopWidthborderWidthbottomboxShadowboxSizingcaretColorclipPathcolumnGapcontaincontainerTypecontentcursordirectiondisabledStyledisplayendenterStyleexitStyleexperimental_backgroundImageexperimental_backgroundPositionexperimental_backgroundRepeatexperimental_backgroundSizefilterflexflexBasisflexDirectionflexGrowflexShrinkflexWrapfloatfocusStylefocusVisibleStylefocusWithinStylegapgridColumngridColumnEndgridColumnGapgridColumnStartgridRowgridRowEndgridRowGapgridRowStartgridTemplateAreasgridTemplateColumnsheighthoverStyleinlineSizeinsetinsetBlockinsetBlockEndinsetBlockStartinsetInlineinsetInlineEndinsetInlineStartisolationjustifyContentmarginmarginBlockmarginBlockEndmarginBlockStartmarginBottommarginEndmarginHorizontalmarginInlinemarginInlineEndmarginInlineStartmarginStartmarginTopmarginVerticalmaskmaskBordermaskBorderModemaskBorderOutsetmaskBorderRepeatmaskBorderSlicemaskBorderSourcemaskBorderWidthmaskClipmaskCompositemaskImagemaskModemaskOriginmaskPositionmaskRepeatmaskSizemaskTypematrixmaxBlockSizemaxHeightmaxInlineSizemaxWidthminBlockSizeminHeightminInlineSizeminWidthmixBlendModeobjectFitopacityoutlineColoroutlineOffsetoutlineStyleoutlineWidthoverflowoverflowBlockoverflowInlinepaddingpaddingBlockpaddingBlockEndpaddingBlockStartpaddingBottompaddingEndpaddingHorizontalpaddingInlinepaddingInlineEndpaddingInlineStartpaddingStartpaddingToppaddingVerticalpassThroughperspectivepointerEventspositionpressStylerotaterotateXrotateYrotateZrotationrowGapscalescaleXscaleYscrollbarWidthseparatorshadowColorshadowOffsetshadowOpacityshadowRadiusskewXskewYspacespaceDirectionstarttextEmphasistextWraptoptouchActiontransformtransformMatrixtransformOrigintransformStyletransitiontranslateXtranslateYuserSelectverticalAlignwidthxyzIndex

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
Row
Next
Spacer
  • Usage
  • Automatic Heading Level Management
  • Using Different HTML Sectioning Elements
  • Accessibility
    • Do
    • Don't
  • Playground