Compass

Info alert:Beta feature

This beta component is currently under review and is still open for further evolution. It is available for use in product. Beta components are considered for promotion on a quarterly basis. Please join in and give us your feedback or submit any questions on the PatternFly forum or via Slack. To learn more about the process, visit our about page or our Beta components page on GitHub.

Examples

Basic

In a basic Compass layout, content can be passed to the following props to populate different areas of the page:

  • header: Content rendered at the top of the page, typically including a <CompassHeader> component that divides the header into 3 areas, with a logo or brand, middle navigation, and profile.
  • sidebarStart: Content rendered at the horizontal start of the page (by default, the left side).
  • main: Content rendered in the center of the page, typically including a <CompassMainHeader> or <CompassHero>, along with a <CompassContent> filled with 1 or more <CompassPanel> components.
  • sidebarEnd: Content rendered at the horizontal end of the page (by default, the right side).
  • footer: Content rendered at the bottom of the page.

To customize the background image of the <Compass> and <CompassHero> components, you can use their respective backgroundSrcLight and backgroundSrcDark props. You can also add and customize a color gradient background for the <CompassHero> component by using the gradientLight and gradientDark props.

Nav
Profile
Sidebar start
Hero
Content title
Content
Sidebar end

When footer is used, its content will fill the width of the screen. By default, when content inside the footer grows, the height and placement of the start and end sidebars will adjust to allow for the change. To modify this behavior and render footer content without interfering with the sidebars, instead place a <CompassMainFooter> inside the main section. This will render content at the bottom of the page between the 2 sidebars, rather than across the entire bottom of the page.

With docked nav

Content
Content title
Content

Composable structure

When building a more custom implementation with Compass components, there are some intended or expected structures that must remain present.

CompassMainHeader structure

When using the children property in the <CompassMainHeader> component, there are specific structural patterns that you should follow, as shown this general code structure.

<CompassMainHeader>
  <CompassPanel>
    <CompassMainHeaderContent>
      {Your custom content goes here, which can include the <CompassMainHeaderTitle> and/or <CompassMainHeaderToolbar> sub-components}
    </CompassMainHeaderContent>
  </CompassPanel>
</CompassMainHeader>

Props

Compass

*required
NameTypeDefaultDescription
backgroundSrcDarkstringDark theme background image path of the Compass
backgroundSrcLightstringLight theme background image path of the Compass
classNamestringAdditional classes added to the Compass.
dockReact.ReactNodeContent of the docked navigation area of the layout
drawerContentReact.ReactNodeContent rendered in an optional drawer wrapping the layout
drawerPropsDrawerPropsAdditional props passed to the drawer
footerReact.ReactNodeContent placed at the bottom of the layout
headerReact.ReactNodeContent placed at the top of the layout
isFooterExpandedbooleantrueFlag indicating if the footer is expanded
isHeaderExpandedbooleantrueFlag indicating if the header is expanded
isSidebarEndExpandedbooleantrueFlag indicating if the end sidebar is expanded
isSidebarStartExpandedbooleantrueFlag indicating if the start sidebar is expanded
mainReact.ReactNodeContent placed at the center of the layout
sidebarEndReact.ReactNodeContent placed at the horizontal end of the layout, after the main content
sidebarStartReact.ReactNodeContent placed at the horizontal start of the layout, before the main content

CompassHeader

*required
NameTypeDefaultDescription
logoReact.ReactNodeContent of the logo area
navReact.ReactNodeContent of the navigation area
profileReact.ReactNodeContent of the profile area

CompassContent

*required
NameTypeDefaultDescription
childrenrequiredReact.ReactNodeContent of the main Compass area. Typically one or more CompassPanel components.
classNamestringAdditional classes added to the CompassContent
drawerContentReact.ReactNodeContent rendered in an optional drawer wrapping the CompassContent
drawerPropsDrawerPropsAdditional props passed to the drawer

CompassHero

A wrapper component to pass a PatternFly Hero component into.
*required
NameTypeDefaultDescription
childrenReact.ReactNodeContent of the hero
classNamestringAdditional classes added to the hero

CompassMainHeader

The wrapper component for header content in the main Compass area. When building out a custom implementation, you should ensure any content within the main header is rendered inside a Compass panel and main header content wrappers.
*required
NameTypeDefaultDescription
childrenReact.ReactNodeCustom main header content. To opt into a default styling, use the title and toolbar props instead.
classNamestringAdditional classes added to the main header
compassPanelPropsOmit<CompassPanelProps, 'children'>Additional props passed to the Compass panel that wraps the main header content when using the title or toolbar props. When using the children prop, you should pass your own Compass panel.
titleReact.ReactNodeStyled title. If title or toolbar is provided, the children will be ignored.
toolbarReact.ReactNodeStyled toolbar. If title or toolbar is provided, the children will be ignored.

CompassPanel

*required
NameTypeDefaultDescription
childrenrequiredReact.ReactNodeContent of the panel.
classNamestringAdditional classes added to the panel.
hasNoBorderbooleanIndicates the panel should have no border
hasNoPaddingbooleanIndicates the panel should have no padding
isFullHeightbooleanIndicates the panel should expand to fill the available height
isPillbooleanIndicates the panel should have a pill border radius
isScrollablebooleanIndicates the panel should scroll its overflow
isThinkingbooleanIndicates the panel should have a "thinking" animation

CompassMessageBar

*required
NameTypeDefaultDescription
childrenReact.ReactNodeContent of the message bar. Typically a @patternfly/chatbot MessageBar component.
classNamestringAdditional classes added to the message bar

CompassMainFooter

*required
NameTypeDefaultDescription
isExpandedNo type infotrue

CSS variables

Expand or collapse columnSelectorVariableValue
.pf-v6-c-compass--pf-v6-c-compass--BackgroundImage
none
.pf-v6-c-compass--pf-v6-c-compass--BackgroundImage--light
none
.pf-v6-c-compass--pf-v6-c-compass--BackgroundImage--dark
none
.pf-v6-c-compass--pf-v6-c-compass--Padding
1.5rem
.pf-v6-c-compass--pf-v6-c-compass--Gap
1.5rem
.pf-v6-c-compass--pf-v6-c-compass__nav--RowGap
0.5rem
.pf-v6-c-compass--pf-v6-c-compass__nav--PaddingBlockStart
0
.pf-v6-c-compass--pf-v6-c-compass__nav--PaddingBlockEnd
0
.pf-v6-c-compass--pf-v6-c-compass__nav--PaddingInlineStart
0.5rem
.pf-v6-c-compass--pf-v6-c-compass__nav--PaddingInlineEnd
0.5rem
.pf-v6-c-compass--pf-v6-c-compass__nav-main--PaddingInlineStart
1.5rem
.pf-v6-c-compass--pf-v6-c-compass__nav-main--PaddingInlineEnd
1.5rem
.pf-v6-c-compass--pf-v6-c-compass__sidebar--PaddingBlockStart
0.5rem
.pf-v6-c-compass--pf-v6-c-compass__sidebar--PaddingBlockEnd
0.5rem
.pf-v6-c-compass--pf-v6-c-compass__sidebar--PaddingInlineStart
0.5rem
.pf-v6-c-compass--pf-v6-c-compass__sidebar--PaddingInlineEnd
0.5rem
.pf-v6-c-compass--pf-v6-c-compass__main--RowGap
1rem
.pf-v6-c-compass--pf-v6-c-compass__main-header-content--RowGap
0.5rem
.pf-v6-c-compass--pf-v6-c-compass__main-header-content--ColumnGap
1rem
.pf-v6-c-compass--pf-v6-c-compass__main-footer--MarginBlockStart
calc(1rem * -1 + 1.5rem)
.pf-v6-c-compass--pf-v6-c-compass__panel--m-pill--BorderRadius
999px
.pf-v6-c-compass--pf-v6-c-compass__panel--PaddingBlockStart
1.5rem
.pf-v6-c-compass--pf-v6-c-compass__panel--PaddingBlockEnd
1.5rem
.pf-v6-c-compass--pf-v6-c-compass__panel--PaddingInlineStart
1.5rem
.pf-v6-c-compass--pf-v6-c-compass__panel--PaddingInlineEnd
1.5rem
.pf-v6-c-compass--pf-v6-c-compass__panel--BackgroundColor
(In light theme) #ffffff
.pf-v6-c-compass--pf-v6-c-compass__panel--BackdropFilter
none
.pf-v6-c-compass--pf-v6-c-compass__panel--BorderColor
(In light theme) #ffffff
.pf-v6-c-compass--pf-v6-c-compass__panel--BorderRadius
24px
.pf-v6-c-compass--pf-v6-c-compass__panel--BorderWidth
1px
.pf-v6-c-compass--pf-v6-c-compass__panel--BoxShadow
0px 4px 9px 0px rgba(41, 41, 41, 0.1500)
.pf-v6-c-compass--pf-v6-c-compass__message-bar--Width
450px
.pf-v6-c-compass--pf-v6-c-compass__message-bar--MinWidth
300px
.pf-v6-c-compass--pf-v6-c-compass__message-bar--MaxWidth
600px
.pf-v6-c-compass--pf-v6-c-compass--section--slide--length--header
100%
.pf-v6-c-compass--pf-v6-c-compass--section--slide--length--sidebar
100%
.pf-v6-c-compass--pf-v6-c-compass--section--slide--length--main-footer
100%
.pf-v6-c-compass--pf-v6-c-compass--section--slide--length--footer
100%
.pf-v6-c-compass--pf-v6-c-compass--section--duration
100ms
.pf-v6-c-compass--pf-v6-c-compass--section--TransitionTimingFunction
cubic-bezier(.4, 0, .2, 1)
.pf-v6-c-compass--pf-v6-c-compass--section--TransitionDuration
100ms, 0s, 0s, 0s, 0s, 0s
.pf-v6-c-compass--pf-v6-c-compass--section--TransitionProperty
opacity, visibility, translate, height, width, margin
.pf-v6-c-compass--pf-v6-c-compass--section--TransitionDelay
0s, 100ms, 100ms, 100ms, 100ms, 100ms
.pf-v6-c-compass--pf-v6-c-compass--section--m-expanded--duration
200ms
.pf-v6-c-compass--pf-v6-c-compass--section--m-expanded--TransitionDuration
200ms, 0s, 0s, 0s, 0s, 0s
.pf-v6-c-compass--pf-v6-c-compass--section--m-expanded--TransitionDelay
0s
.pf-v6-c-compass__panel.pf-m-no-glass--pf-v6-c-compass__panel--BackgroundColor
(In light theme) #ffffff
.pf-v6-c-compass__header.pf-m-expanded--pf-v6-c-compass--section--TransitionDelay
0s
.pf-v6-c-compass__header.pf-m-expanded--pf-v6-c-compass--section--TransitionDuration
200ms, 0s, 0s, 0s, 0s, 0s
.pf-v6-c-compass__nav--pf-v6-c-compass__panel--PaddingBlockStart
0
.pf-v6-c-compass__nav--pf-v6-c-compass__panel--PaddingBlockEnd
0
.pf-v6-c-compass__nav--pf-v6-c-compass__panel--PaddingInlineStart
0.5rem
.pf-v6-c-compass__nav--pf-v6-c-compass__panel--PaddingInlineEnd
0.5rem
.pf-v6-c-compass__sidebar--pf-v6-c-compass__panel--PaddingBlockStart
0.5rem
.pf-v6-c-compass__sidebar--pf-v6-c-compass__panel--PaddingBlockEnd
0.5rem
.pf-v6-c-compass__sidebar--pf-v6-c-compass__panel--PaddingInlineStart
0.5rem
.pf-v6-c-compass__sidebar--pf-v6-c-compass__panel--PaddingInlineEnd
0.5rem