You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import {SectionPaddingBlockStartProp, SectionPaddingBlockEndProp, SectionBackgroundColorProp} from './react'
import{Section}from'@primer/react-brand'
Examples
Default
The default Section wraps its content in a semantic <section> element and provides default paddings.
<Section><SectionIntroalign="center"><SectionIntro.Headingsize="3">Default section</SectionIntro.Heading><SectionIntro.Description>This content is wrapped in a Section component.</SectionIntro.Description></SectionIntro></Section>
With independent block paddings
<SectionpaddingBlockStart="none"paddingBlockEnd="spacious"><SectionIntroalign="center"><SectionIntro.Headingsize="3">Custom paddings</SectionIntro.Heading><SectionIntro.Description>This section has a custom padding at the top and bottom.</SectionIntro.Description></SectionIntro></Section>
With predefined background color
<SectionbackgroundColor="subtle"><SectionIntroalign="center"><SectionIntro.Headingsize="3">Predefined background</SectionIntro.Heading><SectionIntro.Description>This section has a predefined background color.</SectionIntro.Description></SectionIntro></Section>
<ThemeProvidercolorMode="dark"><SectionbackgroundImageSrc="https://github.com/user-attachments/assets/068634a3-926d-49b8-b949-0b1e2a204651"backgroundImageSize="cover"backgroundImagePosition="top center"><SectionIntroalign="center"><SectionIntro.Headingsize="3">Section</SectionIntro.Heading><SectionIntro.Description>This section has a custom background image.</SectionIntro.Description></SectionIntro></Section></ThemeProvider>
<><ThemeProvidercolorMode="dark"><SectionbackgroundColor="default"></Section></ThemeProvider><SectionbackgroundColor="default"rounded><SectionIntroalign="center"><SectionIntro.Headingsize="3">Rounded corners</SectionIntro.Heading><SectionIntro.Description>
This section has rounded top corners that overlap the previous section.
</SectionIntro.Description></SectionIntro></Section></>
Component props
Section
name
type
default
required
description
paddingBlockStart
'normal'
false
Control the padding at the top of the section.
paddingBlockEnd
'normal'
false
Control the padding at the bottom of the section.
backgroundColor
false
Add a background color. Use a predefined color, a CSS custom property, or a custom color value.
backgroundImageSrc
string | string[]ResponsiveMap
false
Add one or more background images.
backgroundImageSize
string | string[]ResponsiveMap
'cover'
false
Control the size of the background image(s). This accepts all CSS background-size supported values, including keywords like contain.
backgroundImagePosition
string | string[]ResponsiveMap
'50%'
false
Control the position of the background image(s). This accepts all CSS background-position supported values, including keywords like top and edge offsets.
rounded
boolean
false
false
Adds rounded corners to the top of the section.
fullWidth
boolean
false
false
Makes the container fill the entire width of the section.