A sidebar that folds down to its icons: actions with icons, a list of recent pages that fades out when folded, and the account at the bottom. Folded, the mark turns into the expand button on hover.
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.
actionsLinks that stay visible as icons when the sidebar is folded.
recentsText only links under the actions, hidden while folded.
recentsLabelHeading of the recent list.
userAccount link at the bottom, with initials drawn from the name.
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 sidebar is unfolded from the medium breakpoint.
defaultOpenInitial state when uncontrolled. Defaults to true.
onOpenChangeCalled when the toggle is pressed.
brandName beside the mark.
brandHrefWhere the brand link points.
expandLabel, collapseLabelAccessible names of the fold buttons.
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
<SidebarCollapsible
open={unfolded}
onOpenChange={setUnfolded}
recents={recentPages}
user={{ name: 'Mira Tan', detail: 'mira@nexvyn.dev', href: '/account' }}
>
<Editor />
</SidebarCollapsible>Source Code
Click the code icon in the top-right corner to view the source code.
License & Usage
// No code loaded.