## Examples

### Basic page components

A page will typically contain the following components:

- A `<Page>` with a `masthead` prop that often contains a [masthead](/components/masthead) component

The `<MastheadMain>` component includes the smaller area that typically contains the `<MastheadToggle>` and a `<MastheadLogo>`. `<MastheadContent>` represents the main portion of the masthead, and will typically contain a `<Toolbar>` or other menu-like components, like a `<Dropdown>`.

- Mastheads contain a `<MastheadMain>` component, which includes the `<MastheadToggle>`, a `<MastheadLogo>`, and the page's toolbar (via `<MastheadContent>`.) The `<MastheadToggle>` component contains a `<PageToggleButton>`, and the `<MastheadLogo>` component contains a `<MastheadBrand>`.
- 1 or more `<PageSidebarBody>` components inside `<PageSidebar>` for vertical navigation or other sidebar content
- 1 or more `<PageSection>` components

### Vertical navigation

To add a vertical sidebar to a `<Page>`, pass a `<PageSidebar>` component into the `sidebar` property. To render navigation in the sidebar, pass a `<PageSidebarBody>` component to `<PageSidebar>`.

The `isSidebarOpen` property helps facilitate the opening and closing of the sidebar and should be 'true' when the sidebar is visible.


import PageVerticalNav from "./PageVerticalNav.tsx?raw"

<LiveExample src={PageVerticalNav} />

### Multiple sidebar body

You can have multiple `<PageSidebarBody>` components inside the `<PageSidebar>` for more customization. You can modify the `<PageSidebarBody>` further by passing the following properties:

- `usePageInsets` will modify the component's insets to match page insets
- `isFilled={true}` will cause the component to grow to fill the available vertical space
- `isFilled={false}` will cause the component to **not** grow to fill the available vertical space

By default, the last `<PageSidebarBody>` will grow to fill the available vertical space. This can be changed by passing `isFilled={false}` as demonstrated in the following example.


import PageMultipleSidebarBody from "./PageMultipleSidebarBody.tsx?raw"

<LiveExample src={PageMultipleSidebarBody} />

### Horizontal navigation

To add horizontal navigation to the top of a `<Page>`, add the navigation inside of a `<ToolbarItem>` in the `<Toolbar>` that is passed to the `<MastheadContent>` of the `<Masthead>`.


import PageHorizontalNav from "./PageHorizontalNav.tsx?raw"

<LiveExample src={PageHorizontalNav} />

### Uncontrolled navigation

When the `isManagedSidebar` property is true, it manages the sidebar open/close state, removing the need to pass both `isSidebarOpen` into the `<PageSidebar>` and `onSidebarToggle` into the `<PageToggleButton>`.


import PageUncontrolledNav from "./PageUncontrolledNav.tsx?raw"

<LiveExample src={PageUncontrolledNav} />

### Filled page sections

By default, page sections will not expand to fill in the available vertical space in a page.

To change this default behavior, pass `isContentFilled` to the `<Page>` component and `isFilled={true}` to any child `<PageSection>` or `<PageGroup>` component that you want to fill the space. If multiple components are set to fill, then the available space will be split equally between them.


import PageWithOrWithoutFill from "./PageWithOrWithoutFill.tsx?raw"

<LiveExample src={PageWithOrWithoutFill} />

### Main section padding

To adjust the padding of a `<PageSection>`, you can pass in different values to the `padding` property. These values should be aligned to a specific breakpoint: 'default', 'sm', 'md', 'lg', 'xl', and '2xl'. Each breakpoint passed into the property should be given a value of either ‘padding’ or ‘noPadding’.

As the page's viewport width increases, breakpoints inherit the padding behavior of the previous breakpoint. For example, padding that is set on 'lg' also applies to 'xl' and '2xl'.

To remove padding entirely, pass 'noPadding' to the `default` breakpoint. For example, the second section in this example passes in `padding={{ default: 'noPadding' }}`. Since no specific breakpoints are mentioned, every breakpoint will have 'noPadding'.

To add padding at specific breakpoints, pass in "padding" at those breakpoints. For example, the third section in this example passes in `padding={{ default: 'noPadding', md: 'padding' }}`. At 'md', 'lg', 'xl', and '2xl' breakpoints, the default value will be overwritten, and padding will be added.

To remove padding at specific breakpoints, pass in 'noPadding' at those breakpoints. For example, the fourth section in this example passes in `padding={{ md: 'noPadding' }}`, which means that 'md', 'lg' 'xl', and '2xl' breakpoints will have `noPadding`.


import PageMainSectionPadding from "./PageMainSectionPadding.tsx?raw"

<LiveExample src={PageMainSectionPadding} />

### Main section variations

This example shows all types of page sections.


import PageMainSectionVariations from "./PageMainSectionVariations.tsx?raw"

<LiveExample src={PageMainSectionVariations} />

### Group section

To group page content sections, add 1 or more `<PageGroup>` components to a `<Page>`.

The following example adds a group containing `<PageBreadcrumb>` and `<PageSection>` components.

To add additional components and information to a group, you may use the following properties:

- To indicate that a breadcrumb should be in a group, use `isBreadcrumbGrouped`.
- To indicate that horizontal sub navigation should be in a group, use `isHorizontalSubnavGrouped`.
- To specify additional group content, use `additionalGroupedContent`.


import PageGroupSection from "./PageGroupSection.tsx?raw"

<LiveExample src={PageGroupSection} />

### Centered section

By default, a page section spans the width of the page. To reduce the width of a section, use the `isWidthLimited` property. To center align width-limited page sections, use the `isCenterAligned` property. When the main content area of a page is wider than the value of a centered, width-limited page section's `--pf-v6-c-page--section--m-limit-width--MaxWidth` custom property, the section will automatically be centered.

The content in this example is placed in a card to better illustrate how the section behaves when it is centered, but a card is not required to center a page section.


import PageCenteredSection from "./PageCenteredSection.tsx?raw"

<LiveExample src={PageCenteredSection} />

### Plain sections and groups

To remove the default background color from a page section or group, use the `isPlain` property on `<PageSection>` or `<PageGroup>` components.


import PagePlainSections from "./PagePlainSections.tsx?raw"

<LiveExample src={PagePlainSections} />

### Dynamic sticky section

A page section may be made sticky with separate control of its sticky positioning and stuck styling using the `stickyBase` and `isStickyStuck` properties. The `stickyBase` property accepts a value of `"top"` or `"bottom"` and applies the base sticky positioning in the given direction. The `isStickyStuck` property applies visual "stuck" styling such as a background, box shadow, and border, and should be toggled based on the scroll position of the scroll parent container.

In this example, a scroll event listener on the scroll parent container toggles `isStickyStuck` when `scrollTop > 0`, so the stuck styling appears only when the content is scrolled.


import PageDynamicStickySection from "./PageDynamicStickySection.tsx?raw"

<LiveExample src={PageDynamicStickySection} />