Demo
You can view this demo in fullscreen mode here.
Usage
This is the sidebar component from shadcn
, with some adjustments to make it easier to use:
- Added the
SidebarNavigationMenu
component - Modified so that icons are clickable when the sidebar is collapsed
- The
DashboardLayout
is pre-configured in each app, so you can use it out of the box.
Note
When you set up the project, a sidebar layout is already configured for each app in shared/layouts/DashboardLayout.tsx
. This file handles active link highlighting separately for each routing library. See the following examples for how to use it with both routing libraries.
Next.js
In Next.js, you can use cookies to persist the sidebar's collapsed state.
tsx
Tanstack Router
tsx