A full width header with the brand and account, and an icon rail under it. Hovering or tabbing into the rail opens it over the page without moving it; the button at the bottom keeps it open and makes room for it.
Dependencies
Interaction Type
An aside with a labelled nav and plain link lists; the current page has aria-current and an accent icon. Toggles are buttons with aria-expanded and aria-controls. Below the medium breakpoint the sidebar becomes a sheet opened from a menu button: focus moves in and is trapped, Escape or the backdrop closes it, and focus returns to the menu button. Only transform and clip-path animate, and reduced motion turns it off.
Props
Options you can pass to customize this component.
itemsLinks in the rail. Give each an icon, since the rail shows icons only.
valueControlled id of the current item. It gets aria-current="page".
defaultValueInitial current item when uncontrolled.
onValueChangeCalled with the item id when a link is pressed.
openControlled state: whether the rail is kept open and pushes the page.
defaultOpenInitial state when uncontrolled. Defaults to false.
onOpenChangeCalled when the toggle is pressed.
peekWhether the closed rail opens over the page on hover and keyboard focus. Defaults to "hover".
brandName beside the mark in the header.
brandHrefWhere the brand link points.
userNameName behind the initials avatar; also the accessible name of its link.
accountHrefWhere the avatar link points.
expandLabel, collapseLabelAccessible names of the keep open button in each state.
titleHeading of the page area. Defaults to the label of the current item.
childrenContent of the page area. Defaults to a placeholder layout.
sidebarLabel, navLabel, menuLabel, closeLabelAccessible names of the sidebar, its navigation and the mobile menu buttons, all overridable for localization.
Installation
How to use
<SidebarRail peek="hover" value={section} onValueChange={setSection}>
<Dashboard />
</SidebarRail>Source Code
Click the code icon in the top-right corner to view the source code.
License & Usage
// No code loaded.