<base-sidenav> is a free layout shell for section navigation: a left rail (<base-sidenav-nav>) and a scrollable body (<base-sidenav-body>). On small screens a hamburger toggles the nav; the mobile breadcrumb label follows the active routerLinkActive item.
Project nav items with routerLink / routerLinkActive="!text-blue-600" (the active class is how the shell picks the mobile label). Put page content or a <router-outlet> in the body.
Demo
Body content scrolls independently of the nav rail. Use the links on the left to switch panels.
<base-scroll-nav> for in-page section TOCs on a single long page.Run the following command to add this shell to your project:
npx base-ui-cli add sidenav
For AI agents
Copy a prompt with the registry name, CLI install, and import — or add the Base UI MCP server.
npx -y base-ui-mcp
Base UI provides standalone components. Import the exact elements you want to use into your component.
// Install: npx base-ui-cli add sidenav
// Paths are relative to aliases.components (default: src/app/components)
import { SidenavBodyComponent } from './sidenav/sidenav-body/sidenav-body.component';
import { SidenavNavComponent } from './sidenav/sidenav-nav/sidenav-nav.component';
import { SidenavComponent } from './sidenav/sidenav.component';
@Component({
selector: 'app-your-component',
imports: [
SidenavBodyComponent,
SidenavComponent,
SidenavNavComponent
],
template: `...`
})
export class YourComponent {} API for sidenav — generated from JSDoc in the library source.
| API | Member | Type | Default | Description |
|---|---|---|---|---|
base-sidenav | class | string | '' | Extra host classes merged via `cn()`. |
base-sidenav | color | IconStrokedButtonColor | undefined | undefined | Color for the mobile nav toggle button. |
base-sidenav | layout | SidenavLayoutMode | 'auto' | Layout chrome mode. `auto` follows the viewport `lg` breakpoint; `mobile` / `desktop` force that chrome (useful for narrow demos). |
base-sidenav-body | — | — | — | Main content slot for `base-sidenav` (typically hosts a router outlet). |
base-sidenav-body | class | string | '' | Extra host classes merged via `cn()`. |
base-sidenav-nav | — | — | — | Left navigation slot for `base-sidenav`. |
base-sidenav-nav | class | string | '' | Extra host classes merged via `cn()`. |
On this page