SideNavigation

Use SideNavigation for side navigation on a page or section.

This component is in the alpha phase and is still under development. The component will support three nested levels and accessibility keyboard navigation. The component will change behavior and the API might also change in future component version releases.
Figma:

Web:

iOS:

Android:

A11y:

Props

Component props
Name
Type
Default
accessibilityLabel
Required
string
-

String that clients such as VoiceOver will read to describe the element.

children
Required
React.Node
-

The content shown in SideNavigation. See subcomponents.

React.Node
-

Content to display at the bottom of SideNavigation. Open slot available to display other functionality required in the page. See the Footer variant to learn more.

header
React.Node
-

Content to display at the top of SideNavigation. Open slot used for controlling the display of navigation items. See the Header variant to learn more.

showBorder
boolean
-

Displays a border in SideNavigation. See the Border variant for more info.

Accessibility

Active item

SideNavigation.TopItem has an "active" state that visually identifies it. To set SideNavigation.TopItem to active pass "page" (page redirect) or "section" (selected content section). Use routing hooks from React.Router or other frameworks to identify the current route. For example, if the current pathname matches the SideNavigation.TopItem href, set SideNavigation.TopItem to "page".

Localization

Be sure to localize the accessibilityLabel in SideNavigation and all subcomponents as well. Note that localization can lengthen text by 20 to 30 percent.

Subcomponents

SideNavigation.Section

Use SideNavigation.Section to create hierarchy within a single SideNavigation

SideNavigation.Section Props

SideNavigation.Section subcomponent props
Name
Type
Default
children
Required
React.Node
-

Any SideNavigation.TopItem to be rendered

label
Required
string
-

Label for the section. See the Sections variant for more info.

SideNavigation.TopItem

Use SideNavigation.TopItem for navigation, when the SideNavigation.TopItem navigates to a new page or sectoin.

SideNavigation.TopItem Props

SideNavigation.TopItem subcomponent props
Name
Type
Default
href
Required
string
-

Directs users to the url when item is selected.

label
Required
string
-

Label for the item.

active
"page" | "section"
-

When set to 'page' or 'section', it displays the item in "active" state. See the Accessibility guidelines to learn more.

badge
{| text: string, type?: "info" | "error" | "warning" | "success" | "neutral", |}
-

When supplied, will display a Badge next to the item's label. See the Badges variant to learn more.

counter
{| number: string, accessibilityLabel: string |}
-

When supplied, will display a counter. See the Counter variant to learn more.

icon
$Keys<typeof icons> | {| __path: string |}
-

When supplied, will display Icon. See the Icon variant to learn more.

notificationAccessibilityLabel
string
-

When supplied, will display a notification dot. See the Notification variant to learn more.

onClick
({| event: | SyntheticMouseEvent<HTMLDivElement> | SyntheticKeyboardEvent<HTMLDivElement> | SyntheticMouseEvent<HTMLAnchorElement> | SyntheticKeyboardEvent<HTMLAnchorElement>, dangerouslyDisableOnNavigation: () => void, |}) => void
-

Callback when the user selects an item using the mouse or keyboard.

SideNavigation.NestedItem

Use SideNavigation.NestedItem

SideNavigation.NestedItem Props

SideNavigation.NestedItem subcomponent props
Name
Type
Default
href
Required
string
-

Directs users to the url when item is selected.

label
Required
string
-

Label for the item.

active
"page" | "section"
-

When set to 'page' or 'section', it displays the item in "active" state. See the Accessibility guidelines to learn more.

onClick
({| event: | SyntheticMouseEvent<HTMLDivElement> | SyntheticKeyboardEvent<HTMLDivElement> | SyntheticMouseEvent<HTMLAnchorElement> | SyntheticKeyboardEvent<HTMLAnchorElement>, dangerouslyDisableOnNavigation: () => void, |}) => void
-

Callback when the user selects an item using the mouse or keyboard.

SideNavigation.Group

Use SideNavigation.Group.

SideNavigation.Group Props

SideNavigation.Group subcomponent props
Name
Type
Default
children
Required
React.Node
-

Content of the group. See nested directory variant for more information.

label
Required
string
-

Label for the group. See nested directory variant for more information.

badge
{| text: string, type?: "info" | "error" | "warning" | "success" | "neutral", |}
-

When supplied, will display a Badge next to the item's label. See the Badges variant to learn more.

counter
{| number: string, accessibilityLabel: string |}
-

When supplied, will display a counter. See the Counter variant to learn more.

display
"expandable" | "static"
"expandable"

Nested directories can be static or expandable. See nested directory variant for more information.

icon
$Keys<typeof icons> | {| __path: string |}
-

When supplied, will display Icon. See the Icon variant to learn more.

notificationAccessibilityLabel
string
-

When supplied, will display a notification dot. See the Notification variant to learn more.

SideNavigation.NestedGroup

Use SideNavigation.NestedGroup.

SideNavigation.NestedGroup Props

SideNavigation.NestedGroup subcomponent props
Name
Type
Default
children
Required
React.Node
-

Content of the group. See nested directory variant for more information.

label
Required
string
-

Label for the group. See nested directory variant for more information.

display
"expandable" | "static"
"expandable"

Nested directories can be static or expandable. See nested directory variant for more information.

Variants

Sections

Badge

Border

Icons

Gestalt icon
Custom icon

Notification

Counters

Nested directory