You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Make SidebarProvider context-only and keep menu primitives composable
#11760
I’d like to suggest separating Sidebar state from Sidebar layout.
SidebarProvider currently does more than provide context: it renders a layout wrapper, applies flex and viewport sizing, and owns the Sidebar width variables. This forces applications to adopt the component’s page-layout conventions or override them.
Could SidebarProvider become context-only, with width and presentation moved onto Sidebar itself? That would let consumers place the Sidebar naturally inside their own grid, flex, nested, or bounded layouts.
The menu primitives would also be more composable if components such as SidebarMenuButton could render outside the provider. Sidebar context is only needed there for collapsed-state tooltip behavior; the button itself does not require Sidebar state.
Provider-dependent components such as Sidebar, SidebarTrigger, and SidebarRail could continue requiring context, while layout-neutral menu primitives could be reused in popovers, sheets, and standalone navigation panels—which is a really nice touch.
This would preserve the existing Sidebar behavior while separating state management, layout, and reusable navigation primitives.
Look how this enabled me to make a custom app switcher that stays consistent with our sidebars.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
I’d like to suggest separating Sidebar state from Sidebar layout.
SidebarProvider currently does more than provide context: it renders a layout wrapper, applies flex and viewport sizing, and owns the Sidebar width variables. This forces applications to adopt the component’s page-layout conventions or override them.
Could SidebarProvider become context-only, with width and presentation moved onto Sidebar itself? That would let consumers place the Sidebar naturally inside their own grid, flex, nested, or bounded layouts.
The menu primitives would also be more composable if components such as SidebarMenuButton could render outside the provider. Sidebar context is only needed there for collapsed-state tooltip behavior; the button itself does not require Sidebar state.
Provider-dependent components such as Sidebar, SidebarTrigger, and SidebarRail could continue requiring context, while layout-neutral menu primitives could be reused in popovers, sheets, and standalone navigation panels—which is a really nice touch.
This would preserve the existing Sidebar behavior while separating state management, layout, and reusable navigation primitives.
Look how this enabled me to make a custom app switcher that stays consistent with our sidebars.
All reactions