Section
The section component groups related content into clearly-defined thematic areas with consistent styling and structure. Use section to organize page content into logical blocks, each with its own heading and visual container.
Sections adjust heading levels automatically with nesting depth, so the document outline stays meaningful and accessible. Shopify controls their visual treatment. For simple visual separation without headings, use divider.
Anchor to Use casesUse cases
- Content grouping: Group related content with automatic semantic heading levels.
- Form organization: Organize complex forms into logical, visually distinct sections.
- Nested structure: Create nested sections for hierarchical content organization.
- Contextual styling: Benefit from context-aware section styling controlled by Shopify.
Preview
html
Anchor to PropertiesProperties
Configure the following properties on the section component.
- Anchor to accessibilityLabelaccessibility
Labelaccessibility Label stringstring A label that describes the purpose or content of the component for assistive technologies like screen readers. Use this to provide additional context when the visible content alone doesn't clearly convey the component's purpose.
- Anchor to headingheadingheadingstringstring
The heading text displayed at the top of the section. This heading provides a title for the section's content and automatically uses the appropriate semantic heading level (h2, h3, h4) based on nesting depth to maintain proper document structure.
- Anchor to subheadingsubheadingsubheadingstringstring
Supporting text that expands on the heading, rendered beneath it in a subdued treatment.
This is not a heading: it adds no entry to the document outline, doesn't change the heading level of the section's children, and isn't announced as part of the heading. Keep whatever distinguishes this section from another in
heading, since that is what someone navigating by heading hears.- Anchor to paddingpaddingpadding"base" | "none""base" | "none"Default: 'base'Default: 'base'
The padding applied to all edges of the element's content.
base: applies padding that is appropriate for the element. Note that it might result in no padding if this is the right design decision in a particular context.none: removes all padding from the element's content. This can be useful when elements inside the section need to span to the edge of the section. For example, a full-width image. In this case, rely ons-boxwith a padding of 'base' to bring back the desired padding for the rest of the content. Theheadingand header actions keep their padding, so they can be combined withnone.
Anchor to SlotsSlots
The section component supports slots for additional content placement within the component. Learn more about using slots.
- Anchor to accessoryaccessoryaccessoryHTMLElementHTMLElement
Additional contextual information that qualifies the heading, rendered inline beside the heading text.
Only accepts Badge, Icon, Button, Menu, Text, Avatar, Thumbnail, and Tooltip elements. Text must use
tone,, andofauto; Icon, Avatar, and Thumbnail must usesize="base"; Badge must usesize="base"andcolor="base"; Button must use.A Tooltip an accessory element's
points at can be slotted here beside it.- Anchor to childrenchildrenchildrenHTMLElementHTMLElement
The content displayed within the section component, which groups related elements together in a logical unit with an optional heading.
- Anchor to graphicgraphicgraphicHTMLElementHTMLElement
A decorative visual that reinforces the heading, rendered before it.
Accepts a single Icon with a
sizeofbase, or an icon-only Badge (iconset, no text content) with asizeoflarge. The heading identifies the section, so this content is not announced by assistive technologies, and it is not rendered at all when the section has noheading.- Anchor to primary-actionprimary-actionprimary-actionHTMLElementHTMLElement
The primary action button or link, representing the main or most important action available in this context. Typically displayed with higher visual prominence than secondary actions to establish clear hierarchy.
- Anchor to secondary-actionssecondary-actionssecondary-actionsHTMLElementHTMLElement
Additional action buttons or links that provide alternative or supporting actions. Visually de-emphasized compared to the primary action.
A ButtonGroup holding an action and the icon-only activator for its Menu renders as one segmented group with a chevron activator. The group needs an
, and must hold exactly one Button with text followed by one Button with no text that has anand aopening a Menu, both with avariantofsecondaryorauto.- Anchor to supplementalsupplementalsupplementalHTMLElementHTMLElement
Status or metadata that describes the section as a whole rather than qualifying its heading, rendered at the inline-end of the header before any actions.
This is not an action. Only accepts Badge, Avatar, Text, Icon, and Thumbnail elements, under the same prop constraints as
accessory.
Anchor to ExamplesExamples
Anchor to Add a content section with a headingAdd a content section with a heading
Create a section with a heading to group related content. This example shows a basic section with a title and description text.
Preview
html
Anchor to Group form fields in a sectionGroup form fields in a section
Use a section with a heading and form fields to group related inputs. This example shows a customer information form with text and email fields inside a top-level section.
Preview
html
Nest sections to group related content under a heading that describes it. Heading levels follow nesting depth automatically: the top-level heading is an h2, the one nested inside it an h3, and the next an h4. Nesting is a semantic structure, not a visual one, so a nested section doesn't draw its own card.
Preview
html
Anchor to Add an accessibility label for screen readersAdd an accessibility label for screen readers
Use the accessibilityLabel property to provide screen readers with additional context beyond the visible heading. This example shows a payment summary section and a label describing the contents of the section.
Preview
html
Anchor to Remove padding for full-width contentRemove padding for full-width content
Set the padding property to none so that content like tables can extend to the section edges. This example shows a product table rendered full-width within a section.
Preview
html
Anchor to Add actions to a section headerAdd actions to a section header
Use the primary-action slot for one button with variant="primary", and the secondary-actions slot for supporting buttons. A section header shows two actions inline at most, either a primary action with one secondary action or two secondary actions, and rolls the rest into a generated More actions menu.
Preview
html
Anchor to Qualify a heading with accessory contentQualify a heading with accessory content
Use the accessory slot for content that qualifies the heading, such as a count or an explanation. The slot renders inline after the heading text and accepts badge, icon, button, menu, text, avatar, thumbnail, and tooltip elements. This example pairs a count badge with an icon-only button that opens a tooltip slotted beside it.
Preview
html
Anchor to Show section status with supplemental contentShow section status with supplemental content
Use the supplemental slot to report the state of the section as a whole. It renders at the inline-end of the header, before any actions, and accepts badge, avatar, text, icon, and thumbnail elements. It reports state rather than offering an action, so unlike accessory it takes no buttons or menus. Slotted text and icons can still point at a tooltip with interestFor.
Preview
html
Anchor to Reinforce a heading with a graphicReinforce a heading with a graphic
Use the graphic slot for a decorative visual that reinforces the heading. It accepts one icon with size="base", or one badge with size="large" that carries an icon and no text. Assistive technologies skip the graphic, and a section without a heading doesn't render it at all.
Preview
html
Anchor to Combine the header slotsCombine the header slots
Header slots combine. This example uses all five: a graphic before the heading, accessory content after the heading text, supplemental status at the inline-end, and a primary action with one secondary action.
Preview
html
Anchor to Best practicesBest practices
- Use to group related content: The component provides semantic structure and a visual container for grouping related content. Each section should contain a cohesive set of information or controls that belong together.
- Provide meaningful headings: Section headings help merchants scan and navigate content. Write headings that clearly describe what's in the section rather than using vague labels.
- Nest thoughtfully: Nesting adjusts heading levels, so it structures the document outline rather than the visuals. Excessive nesting creates overly complex structures, so limit it to 2-3 levels where the hierarchy is meaningful and helps merchants understand the content organization.
- Consider when to remove padding: Full-width content like tables or images might need to extend to section edges. Remove padding when the content design requires it, but ensure nested content within has appropriate spacing.
- Use accessibility labels when needed: When the visible heading doesn't fully convey the section's purpose to screen reader users, provide an accessibility label with additional context.
- Choose between accessory and supplemental: Put content that qualifies the heading, like a count or a tooltip, in
accessory. Put the state of the whole section, like a status badge, insupplemental. Onlyaccessorytakes an action, such as a button or a menu. - Keep header actions short: A section header shows two actions inline at most, and rolls the rest into a generated menu. Give an icon-only action an
accessibilityLabel, which also becomes its tooltip and its menu item text once it rolls up. - Keep the graphic decorative: Assistive technologies skip the
graphicslot, so anything a merchant needs to read belongs in theheadingorsubheadingproperty, or in thesupplementalslot.
Anchor to LimitationsLimitations
- The component doesn't include expand/collapse functionality. If you need collapsible sections, you'll need to implement this using additional state management and accessibility attributes.
- Section headings automatically increment their semantic level based on nesting depth, but they stop at h4 for deeply nested sections. Content nested beyond three levels might have less clear document structure.