Introducing PrimeReact v11-alpha 🎉Discover Now

Sidebar

Sidebar is a layout component for building application navigation with collapsible panels, multi-variant styling, and composable menu structures.

Navigation
  • 12
  • 3
Projects
Billing
preview

Usage#

import { Sidebar } from '@primereact/ui/sidebar';
<Sidebar.Layout>
    <Sidebar.Root id="main" collapsible="icon">
        <Sidebar.Spacer />
        <Sidebar.Panel>
            <Sidebar.Body>
                <Sidebar.Header>...</Sidebar.Header>
                <Sidebar.Content>
                    <Sidebar.Group>
                        <Sidebar.GroupLabel>Navigation</Sidebar.GroupLabel>
                        <Sidebar.GroupContent>
                            <Sidebar.Menu>
                                <Sidebar.MenuItem>
                                    <Sidebar.MenuButton isActive>
                                        <HomeIcon />
                                        <span>Home</span>
                                    </Sidebar.MenuButton>
                                </Sidebar.MenuItem>
                            </Sidebar.Menu>
                        </Sidebar.GroupContent>
                    </Sidebar.Group>
                </Sidebar.Content>
                <Sidebar.Footer>...</Sidebar.Footer>
            </Sidebar.Body>
        </Sidebar.Panel>
    </Sidebar.Root>
    <Sidebar.Inset>
        <Sidebar.Trigger />
        <main>Content</main>
    </Sidebar.Inset>
</Sidebar.Layout>

Examples#

Variants#

Use the variant and collapsible props to control the sidebar appearance and collapse behavior.

Navigation
  • 12
  • 3
Projects
Billing
variants-demo

With Menu#

Company switcher in the header and user menu in the footer using Popover and Menu components.

Navigation
menu-demo

Responsive#

Use useIsMobile hook to switch between desktop and mobile layouts. On mobile, the sidebar becomes offcanvas with overlay and backdrop.

Menu
  • 3
DashboardDesktop
responsive-demo

Dual Sidebar#

Navigation
  • 5
Projects
Dashboard
Weekly metrics overview
Show me this week's metrics

Here are your key metrics for this week:

  • Page views12,482
  • New users342
  • Bounce rate34%
dual-demo

Multi Sidebar#

Settings
Configuration
Integrations
Billing
Table Editor/ users
multi-demo

Nested Menu#

Recursive menu structure with deeply nested sub-items using Sidebar.MenuSub and a recursive render function.

Files
File Manager

Q1 Report

Documents > Work > Projects > Q1 Report

nested-demo

Chat Application#

Today
Yesterday
Previous 7 days
Previous 30 days
chat-demo