Introducing PrimeReact v11-alpha 🎉Discover Now

Sidebar

An unstyled layout component for building application navigation with collapsible panels, multi-variant styling, and composable menu structures.

Build fully custom application sidebars with compound components for layout, menus, and collapsible sections.

Navigation
  • 12
  • 3
Projects
Billing
Dashboard

Welcome back, John

Select an item from the sidebar to get started.

basic-demo

Pre-styled Versions

Choose a pre-styled library to use Sidebar with ready-made designs.
For hook-based usage without components, see the Headless API.

Features#

  • Compound component API with sub-components: Layout, Root, Spacer, Panel, Body, Header, Content, Footer, Group, GroupLabel, GroupContent, Menu, MenuItem, MenuButton, MenuAction, MenuBadge, MenuSub, MenuSubItem, MenuSubButton, Trigger, Rail, Inset, Backdrop
  • Three visual variants: sidebar, floating, inset
  • Three collapsible modes: icon, offcanvas, none
  • Left and right side positioning
  • Multi-sidebar support with Layout + id/target
  • Collapsible menu items with animated expand/collapse via useMotion
  • Hover-to-open with configurable delays
  • Overlay mode with animated Backdrop
  • Controlled and uncontrolled open state

Usage#

import { Sidebar } from 'primereact/sidebar';
<Sidebar.Layout>
    <Sidebar.Root id="main" collapsible="icon">
        <Sidebar.Spacer />
        <Sidebar.Aside>
            <Sidebar.Panel>
                <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.Rail />
            </Sidebar.Panel>
        </Sidebar.Aside>
    </Sidebar.Root>
    <Sidebar.Main>
        <Sidebar.Trigger />
        <main>Content</main>
    </Sidebar.Main>
</Sidebar.Layout>

Behavior#

Polymorphic Rendering#

Use as on any sub-component to change the rendered HTML element.

<Sidebar.Trigger as="div">...</Sidebar.Trigger>

Render Function Children#

Sub-components accept a render function as children, providing access to the component instance.

<Sidebar.Content>{(instance) => <div>{instance.sidebar?.state.open ? 'Open' : 'Closed'}</div>}</Sidebar.Content>

Collapsible Menu Items#

Add collapsible prop to MenuItem for animated expandable submenus.

<Sidebar.MenuItem collapsible defaultOpen={false}>
    <Sidebar.MenuButton>
        <FolderIcon />
        <span>Documents</span>
    </Sidebar.MenuButton>
    <Sidebar.MenuSub>
        <Sidebar.MenuSubItem>
            <Sidebar.MenuSubButton>Shared</Sidebar.MenuSubButton>
        </Sidebar.MenuSubItem>
    </Sidebar.MenuSub>
</Sidebar.MenuItem>

Multi-Sidebar#

Use Layout with id and target props for multiple independent sidebars.

<Sidebar.Layout>
    <Sidebar.Root side="left" id="nav">
        ...
    </Sidebar.Root>
    <Sidebar.Main>
        <Sidebar.Trigger target="nav" />
        <Sidebar.Trigger target="tools" />
    </Sidebar.Main>
    <Sidebar.Root side="right" id="tools">
        ...
    </Sidebar.Root>
</Sidebar.Layout>

Pass Through#

Some parts may not be visible in the preview depending on the component's current state.

Loading...
/* Select a part to see its CSS selector for custom styling */

API#

SidebarLayout#

SidebarRoot#

AttributeValue
data-state"expanded" | "collapsed"
data-variant"sidebar" | "floating" | "inset"
data-collapsible"offcanvas" | "icon" | "" (empty when expanded)
data-collapsible-mode"offcanvas" | "icon" | "none" (always present)
data-side"left" | "right"
data-overlayPresent when overlay is true

SidebarSpacer#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: SidebarSpacerInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: SidebarSpacerInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceSidebarSpacerInstance—
The instance to pass to the component.
ptSafeRecord<SidebarSpacerPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: SidebarSpacerInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.

Defines passthrough(pt) options of SidebarSpacer component.

labeltypedescription
rootSidebarSpacerPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.

SidebarAside#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: SidebarAsideInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: SidebarAsideInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceSidebarAsideInstance—
The instance to pass to the component.
ptSafeRecord<SidebarAsidePassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: SidebarAsideInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.

Defines passthrough(pt) options of SidebarAside component.

labeltypedescription
rootSidebarAsidePassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.

SidebarPanel#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: SidebarPanelInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: SidebarPanelInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceSidebarPanelInstance—
The instance to pass to the component.
ptSafeRecord<SidebarPanelPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: SidebarPanelInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.

Defines passthrough(pt) options of SidebarPanel component.

labeltypedescription
rootSidebarPanelPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.

SidebarHeader#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: SidebarHeaderInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: SidebarHeaderInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceSidebarHeaderInstance—
The instance to pass to the component.
ptSafeRecord<SidebarHeaderPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: SidebarHeaderInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.

Defines passthrough(pt) options of SidebarHeader component.

labeltypedescription
rootSidebarHeaderPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.

SidebarContent#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: SidebarContentInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: SidebarContentInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceSidebarContentInstance—
The instance to pass to the component.
ptSafeRecord<SidebarContentPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: SidebarContentInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.

Defines passthrough(pt) options of SidebarContent component.

labeltypedescription
rootSidebarContentPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.

SidebarFooter#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: SidebarFooterInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: SidebarFooterInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceSidebarFooterInstance—
The instance to pass to the component.
ptSafeRecord<SidebarFooterPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: SidebarFooterInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.

Defines passthrough(pt) options of SidebarFooter component.

labeltypedescription
rootSidebarFooterPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.

SidebarGroup#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: SidebarGroupInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: SidebarGroupInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceSidebarGroupInstance—
The instance to pass to the component.
ptSafeRecord<SidebarGroupPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: SidebarGroupInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.

Defines passthrough(pt) options of SidebarGroup component.

labeltypedescription
rootSidebarGroupPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.

SidebarGroupLabel#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: SidebarGroupLabelInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: SidebarGroupLabelInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceSidebarGroupLabelInstance—
The instance to pass to the component.
ptSafeRecord<SidebarGroupLabelPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: SidebarGroupLabelInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.

Defines passthrough(pt) options of SidebarGroupLabel component.

labeltypedescription
rootSidebarGroupLabelPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.

SidebarGroupContent#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: SidebarGroupContentInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: SidebarGroupContentInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceSidebarGroupContentInstance—
The instance to pass to the component.
ptSafeRecord<SidebarGroupContentPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: SidebarGroupContentInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.

Defines passthrough(pt) options of SidebarGroupContent component.

labeltypedescription
rootSidebarGroupContentPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.

SidebarMenu#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: SidebarMenuInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: SidebarMenuInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceSidebarMenuInstance—
The instance to pass to the component.
ptSafeRecord<SidebarMenuPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: SidebarMenuInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.

Defines passthrough(pt) options of SidebarMenu component.

labeltypedescription
rootSidebarMenuPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.

SidebarMenuItem#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: SidebarMenuItemInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: SidebarMenuItemInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceSidebarMenuItemInstance—
The instance to pass to the component.
ptSafeRecord<SidebarMenuItemPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: SidebarMenuItemInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
collapsibleboolean—
Whether the menu item is collapsible.
openboolean—
Whether the menu item is open (controlled).
defaultOpenboolean—
Whether the menu item is open by default (uncontrolled).
onOpenChange(event: { originalEvent: SyntheticEvent; value: boolean }) => void—
Callback invoked when the open state changes.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.
AttributeValue
data-openPresent when the menu item is expanded

Defines passthrough(pt) options of SidebarMenuItem component.

labeltypedescription
rootSidebarMenuItemPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.

SidebarMenuButton#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: SidebarMenuButtonInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: SidebarMenuButtonInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceSidebarMenuButtonInstance—
The instance to pass to the component.
ptSafeRecord<SidebarMenuButtonPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: SidebarMenuButtonInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
isActiveboolean—
Whether the menu button is in an active state.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.
AttributeValue
data-active"true" when the button is active

Defines passthrough(pt) options of SidebarMenuButton component.

labeltypedescription
rootSidebarMenuButtonPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.

SidebarMenuAction#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: SidebarMenuActionInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: SidebarMenuActionInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceSidebarMenuActionInstance—
The instance to pass to the component.
ptSafeRecord<SidebarMenuActionPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: SidebarMenuActionInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
showOnHoverboolean—
Whether the action is only shown on hover.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.

Defines passthrough(pt) options of SidebarMenuAction component.

labeltypedescription
rootSidebarMenuActionPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.

SidebarMenuBadge#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: SidebarMenuBadgeInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: SidebarMenuBadgeInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceSidebarMenuBadgeInstance—
The instance to pass to the component.
ptSafeRecord<SidebarMenuBadgePassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: SidebarMenuBadgeInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.

Defines passthrough(pt) options of SidebarMenuBadge component.

labeltypedescription
rootSidebarMenuBadgePassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.

SidebarMenuSub#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: SidebarMenuSubInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: SidebarMenuSubInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceSidebarMenuSubInstance—
The instance to pass to the component.
ptSafeRecord<SidebarMenuSubPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: SidebarMenuSubInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
lazyboolean—
Whether the submenu content is lazily rendered.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.

Defines passthrough(pt) options of SidebarMenuSub component.

labeltypedescription
rootSidebarMenuSubPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.

SidebarMenuSubItem#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: SidebarMenuSubItemInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: SidebarMenuSubItemInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceSidebarMenuSubItemInstance—
The instance to pass to the component.
ptSafeRecord<SidebarMenuSubItemPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: SidebarMenuSubItemInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.

Defines passthrough(pt) options of SidebarMenuSubItem component.

labeltypedescription
rootSidebarMenuSubItemPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.

SidebarMenuSubButton#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: SidebarMenuSubButtonInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: SidebarMenuSubButtonInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceSidebarMenuSubButtonInstance—
The instance to pass to the component.
ptSafeRecord<SidebarMenuSubButtonPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: SidebarMenuSubButtonInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
isActiveboolean—
Whether the submenu button is in an active state.
size"sm" | "md"—
The size of the submenu button.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.
AttributeValue
data-active"true" when the button is active
data-size"sm" when small size is set

Defines passthrough(pt) options of SidebarMenuSubButton component.

labeltypedescription
rootSidebarMenuSubButtonPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.

SidebarTrigger#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: SidebarTriggerInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: SidebarTriggerInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceSidebarTriggerInstance—
The instance to pass to the component.
ptSafeRecord<SidebarTriggerPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: SidebarTriggerInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
targetstring—
The target sidebar to toggle.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.

Defines passthrough(pt) options of SidebarTrigger component.

labeltypedescription
rootSidebarTriggerPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.

SidebarRail#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: SidebarRailInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: SidebarRailInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceSidebarRailInstance—
The instance to pass to the component.
ptSafeRecord<SidebarRailPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: SidebarRailInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.

Defines passthrough(pt) options of SidebarRail component.

labeltypedescription
rootSidebarRailPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.

SidebarMain#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: SidebarMainInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: SidebarMainInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceSidebarMainInstance—
The instance to pass to the component.
ptSafeRecord<SidebarMainPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: SidebarMainInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.

Defines passthrough(pt) options of SidebarMain component.

labeltypedescription
rootSidebarMainPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.

SidebarBackdrop#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: SidebarBackdropInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: SidebarBackdropInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceSidebarBackdropInstance—
The instance to pass to the component.
ptSafeRecord<SidebarBackdropPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: SidebarBackdropInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
motionPropsMotionProps—
The motion properties for the backdrop animation.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.

Uses the Backdrop component internally for animated overlay rendering.

Defines passthrough(pt) options of SidebarBackdrop component.

labeltypedescription
rootSidebarBackdropPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.

Accessibility#

Screen Reader#

Sidebar uses navigation landmark role by default. The Trigger element toggles the sidebar open state. Each MenuItem uses button role for interactive menu items.

Keyboard Support#

KeyFunction
tabMoves focus to the next focusable element.
shift + tabMoves focus to the previous focusable element.
enterActivates the focused menu button or trigger.
spaceActivates the focused menu button or trigger.