Skip to content
All components
Navigation

Sidebar

Build the persistent navigation shell of an application: a side panel of grouped destinations that collapses on desktop and becomes a modal sheet below 768 CSS px.

The application shell sidebar, collapsible and mobile aware.

Installation

tdpxl is not an npm dependency of your app. The @tdpxl/cli command (not published to npm yet) copies the source into your project, with the registry items and npm packages it imports.

npx @tdpxl/cli add sidebar

Then import it from @/components/ui/sidebar. New project? Start with the installation guide.

Examples

Each example is one branch of the official demo, rendered in its own frame. The code is that branch as you would write it, with imports pointing at the default install paths.

Nested navigation

Nest second-level links under a section with the menu sub parts. Menu parts render without a provider; the current link sets aria-current alongside isActive.

"use client"

import { BookOpenIcon, FileTextIcon } from "lucide-react"
import * as React from "react"

import {
  SidebarGroup,
  SidebarGroupContent,
  SidebarGroupLabel,
  SidebarMenu,
  SidebarMenuButton,
  SidebarMenuItem,
  SidebarMenuSub,
  SidebarMenuSubButton,
  SidebarMenuSubItem,
} from "@/components/ui/sidebar"

export function SidebarNestedNavigation() {
  const id = React.useId()
  return (
    <div className="flex w-full max-w-2xl flex-col gap-6">
      <nav
        aria-labelledby={`${id}-docs`}
        className="w-full max-w-64 rounded-16 border border-soft-200 bg-white-0 p-2"
      >
        <SidebarGroup>
          <SidebarGroupLabel id={`${id}-docs`}>Documentation</SidebarGroupLabel>
          <SidebarGroupContent>
            <SidebarMenu>
              <SidebarMenuItem>
                <SidebarMenuButton asChild>
                  <a href="#">
                    <BookOpenIcon />
                    <span>Guides</span>
                  </a>
                </SidebarMenuButton>
                <SidebarMenuSub>
                  <SidebarMenuSubItem>
                    <SidebarMenuSubButton href="#">Installation</SidebarMenuSubButton>
                  </SidebarMenuSubItem>
                  <SidebarMenuSubItem>
                    <SidebarMenuSubButton href="#" isActive aria-current="page">
                      Theming
                    </SidebarMenuSubButton>
                  </SidebarMenuSubItem>
                  <SidebarMenuSubItem>
                    <SidebarMenuSubButton href="#">Deployment</SidebarMenuSubButton>
                  </SidebarMenuSubItem>
                </SidebarMenuSub>
              </SidebarMenuItem>
              <SidebarMenuItem>
                <SidebarMenuButton asChild>
                  <a href="#">
                    <FileTextIcon />
                    <span>API reference</span>
                  </a>
                </SidebarMenuButton>
              </SidebarMenuItem>
            </SidebarMenu>
          </SidebarGroupContent>
        </SidebarGroup>
      </nav>
    </div>
  )
}

Group actions and badges

Add a group action, item actions and a count badge to menu items. Every icon-only action is named, and the count is part of the link's accessible name.

"use client"

import {
  ArchiveIcon,
  FolderIcon,
  InboxIcon,
  PlusIcon,
} from "lucide-react"
import * as React from "react"

import {
  SidebarGroup,
  SidebarGroupAction,
  SidebarGroupContent,
  SidebarGroupLabel,
  SidebarMenu,
  SidebarMenuAction,
  SidebarMenuBadge,
  SidebarMenuButton,
  SidebarMenuItem,
} from "@/components/ui/sidebar"

export function SidebarGroupActionsAndBadges() {
  const id = React.useId()
  return (
    <div className="flex w-full max-w-2xl flex-col gap-6">
      <nav
        aria-labelledby={`${id}-projects`}
        className="w-full max-w-64 rounded-16 border border-soft-200 bg-white-0 p-2"
      >
        <SidebarGroup>
          <SidebarGroupLabel id={`${id}-projects`}>Projects</SidebarGroupLabel>
          <SidebarGroupAction aria-label="Create project">
            <PlusIcon />
          </SidebarGroupAction>
          <SidebarGroupContent>
            <SidebarMenu>
              <SidebarMenuItem>
                <SidebarMenuButton asChild className="pe-9">
                  <a href="#">
                    <InboxIcon />
                    <span>Inbox</span>
                    <span className="sr-only">, 12 unread</span>
                  </a>
                </SidebarMenuButton>
                <SidebarMenuBadge aria-hidden="true">12</SidebarMenuBadge>
              </SidebarMenuItem>
              <SidebarMenuItem>
                <SidebarMenuButton asChild className="pe-9">
                  <a href="#">
                    <FolderIcon />
                    <span>Website redesign</span>
                  </a>
                </SidebarMenuButton>
                <SidebarMenuAction aria-label="Archive Website redesign">
                  <ArchiveIcon />
                </SidebarMenuAction>
              </SidebarMenuItem>
              <SidebarMenuItem>
                <SidebarMenuButton asChild className="pe-9">
                  <a href="#">
                    <FolderIcon />
                    <span>Quarterly report</span>
                  </a>
                </SidebarMenuButton>
                <SidebarMenuAction aria-label="Archive Quarterly report">
                  <ArchiveIcon />
                </SidebarMenuAction>
              </SidebarMenuItem>
            </SidebarMenu>
          </SidebarGroupContent>
        </SidebarGroup>
      </nav>
    </div>
  )
}

Loading menu

Hold the menu's layout with skeleton rows while items load. A polite status message tells assistive technology what is loading.

"use client"

import {
  SidebarGroup,
  SidebarGroupLabel,
  SidebarMenu,
  SidebarMenuItem,
  SidebarMenuSkeleton,
} from "@/components/ui/sidebar"

export function SidebarLoadingMenu() {
  
  return (
    <div className="flex w-full max-w-2xl flex-col gap-6">
      <div className="w-full max-w-64 rounded-16 border border-soft-200 bg-white-0 p-2">
        <SidebarGroup aria-busy="true">
          <SidebarGroupLabel>Recent files</SidebarGroupLabel>
          <p role="status" className="sr-only">
            Loading recent files
          </p>
          <SidebarMenu>
            {[0, 1, 2].map((row) => (
              <SidebarMenuItem key={row}>
                <SidebarMenuSkeleton showIcon />
              </SidebarMenuItem>
            ))}
          </SidebarMenu>
        </SidebarGroup>
      </div>
    </div>
  )
}

API reference

Generated from the component's TypeScript signatures. Inherited DOM and primitive props are listed separately.

Sidebar

Compose persistent application navigation with responsive disclosure.

Sidebar props
PropTypeDefaultDescription
inputMode"search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined—Hints at the type of data that might be entered by the user while editing the element or its contents
aria-describedbystring | undefined—Identifies the element (or elements) that describes the object.
aria-invalidboolean | "false" | "true" | "grammar" | "spelling" | undefined—Indicates the entered value does not conform to the format expected by the application.
aria-labelstring | undefined—Defines a string value that labels the current element.
aria-labelledbystring | undefined—Identifies the element (or elements) that labels the current element.
childrenReact.ReactNode—Represents all of the things React can render.
side"right" | "left" | undefined"left"Place the sidebar on the left or right edge. This does not determine text direction.
variant"sidebar" | "floating" | "inset" | undefined"sidebar"Sidebar surface treatment: sidebar, floating or inset. Compose inset mode with SidebarInset.
collapsible"none" | "offcanvas" | "icon" | undefined"offcanvas"Sidebar collapse behavior: remain visible, move off canvas, or reduce to an icon rail.
mobileTitleReact.ReactNode"Navigation"Visually hidden title of the mobile sheet. Translate it with the rest of the interface.
mobileDescriptionReact.ReactNode"The sections of this application."Visually hidden description of the mobile sheet.
Inherited props (13)
Sidebar inherited props
PropTypeDefaultDescription
refReact.Ref<HTMLDivElement> | undefined—Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).
defaultCheckedboolean | undefined—Initial checked state for a control supporting uncontrolled selection. Inherited DOM typing does not give a layout wrapper checkbox behavior.
defaultValuestring | number | readonly string[] | undefined—Initial value for a control supporting uncontrolled state. Inherited DOM typing alone does not give a layout wrapper input behavior.
autoFocusboolean | undefined—Request automatic focus when the element mounts or the primitive opens, according to its source behavior. Choose initial focus deliberately in context.
classNamestring | undefined—Additional classes for this part. Preserve contrast, visible focus and responsive content when adapting styles.
idstring | undefined—Stable DOM identifier used by labels, descriptions or other explicit associations.
roleReact.AriaRole | undefined—Semantic role appropriate to the rendered element. Preserve required relationships and keyboard behavior.
onFocusReact.FocusEventHandler<HTMLDivElement> | undefined—Receive the native focus event. Preserve the component's existing keyboard and focus behavior.
onBlurReact.FocusEventHandler<HTMLDivElement> | undefined—Receive the native blur event when focus leaves this control.
onChangeReact.ChangeEventHandler<HTMLDivElement, Element> | undefined—Receive the native change event; read the actual control value or checked state from its event target.
onKeyDownReact.KeyboardEventHandler<HTMLDivElement> | undefined—Receive keyboard events. Preserve built-in keyboard behavior unless deliberately implementing an accessible alternative.
onClickReact.MouseEventHandler<HTMLDivElement> | undefined—Receive activation events. The consumer owns the action performed and its result.
onSelectReact.ReactEventHandler<HTMLDivElement> | undefined—Handle the selection event defined by this part's source signature. DOM text-selection events differ from menu or command activation callbacks.

SidebarContent

Content region within the root composition. Keep required providers, labels and related controls from the complete example.

SidebarContent props
PropTypeDefaultDescription
inputMode"search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined—Hints at the type of data that might be entered by the user while editing the element or its contents
aria-describedbystring | undefined—Identifies the element (or elements) that describes the object.
aria-invalidboolean | "false" | "true" | "grammar" | "spelling" | undefined—Indicates the entered value does not conform to the format expected by the application.
aria-labelstring | undefined—Defines a string value that labels the current element.
aria-labelledbystring | undefined—Identifies the element (or elements) that labels the current element.
childrenReact.ReactNode—Represents all of the things React can render.
Inherited props (13)
SidebarContent inherited props
PropTypeDefaultDescription
refReact.Ref<HTMLDivElement> | undefined—Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).
defaultCheckedboolean | undefined—Initial checked state for a control supporting uncontrolled selection. Inherited DOM typing does not give a layout wrapper checkbox behavior.
defaultValuestring | number | readonly string[] | undefined—Initial value for a control supporting uncontrolled state. Inherited DOM typing alone does not give a layout wrapper input behavior.
autoFocusboolean | undefined—Request automatic focus when the element mounts or the primitive opens, according to its source behavior. Choose initial focus deliberately in context.
classNamestring | undefined—Additional classes for this part. Preserve contrast, visible focus and responsive content when adapting styles.
idstring | undefined—Stable DOM identifier used by labels, descriptions or other explicit associations.
roleReact.AriaRole | undefined—Semantic role appropriate to the rendered element. Preserve required relationships and keyboard behavior.
onFocusReact.FocusEventHandler<HTMLDivElement> | undefined—Receive the native focus event. Preserve the component's existing keyboard and focus behavior.
onBlurReact.FocusEventHandler<HTMLDivElement> | undefined—Receive the native blur event when focus leaves this control.
onChangeReact.ChangeEventHandler<HTMLDivElement, Element> | undefined—Receive the native change event; read the actual control value or checked state from its event target.
onKeyDownReact.KeyboardEventHandler<HTMLDivElement> | undefined—Receive keyboard events. Preserve built-in keyboard behavior unless deliberately implementing an accessible alternative.
onClickReact.MouseEventHandler<HTMLDivElement> | undefined—Receive activation events. The consumer owns the action performed and its result.
onSelectReact.ReactEventHandler<HTMLDivElement> | undefined—Handle the selection event defined by this part's source signature. DOM text-selection events differ from menu or command activation callbacks.

SidebarFooter

Footer layout for supporting content or actions; consumers own the actions and their outcomes.

SidebarFooter props
PropTypeDefaultDescription
inputMode"search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined—Hints at the type of data that might be entered by the user while editing the element or its contents
aria-describedbystring | undefined—Identifies the element (or elements) that describes the object.
aria-invalidboolean | "false" | "true" | "grammar" | "spelling" | undefined—Indicates the entered value does not conform to the format expected by the application.
aria-labelstring | undefined—Defines a string value that labels the current element.
aria-labelledbystring | undefined—Identifies the element (or elements) that labels the current element.
childrenReact.ReactNode—Represents all of the things React can render.
Inherited props (13)
SidebarFooter inherited props
PropTypeDefaultDescription
refReact.Ref<HTMLDivElement> | undefined—Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).
defaultCheckedboolean | undefined—Initial checked state for a control supporting uncontrolled selection. Inherited DOM typing does not give a layout wrapper checkbox behavior.
defaultValuestring | number | readonly string[] | undefined—Initial value for a control supporting uncontrolled state. Inherited DOM typing alone does not give a layout wrapper input behavior.
autoFocusboolean | undefined—Request automatic focus when the element mounts or the primitive opens, according to its source behavior. Choose initial focus deliberately in context.
classNamestring | undefined—Additional classes for this part. Preserve contrast, visible focus and responsive content when adapting styles.
idstring | undefined—Stable DOM identifier used by labels, descriptions or other explicit associations.
roleReact.AriaRole | undefined—Semantic role appropriate to the rendered element. Preserve required relationships and keyboard behavior.
onFocusReact.FocusEventHandler<HTMLDivElement> | undefined—Receive the native focus event. Preserve the component's existing keyboard and focus behavior.
onBlurReact.FocusEventHandler<HTMLDivElement> | undefined—Receive the native blur event when focus leaves this control.
onChangeReact.ChangeEventHandler<HTMLDivElement, Element> | undefined—Receive the native change event; read the actual control value or checked state from its event target.
onKeyDownReact.KeyboardEventHandler<HTMLDivElement> | undefined—Receive keyboard events. Preserve built-in keyboard behavior unless deliberately implementing an accessible alternative.
onClickReact.MouseEventHandler<HTMLDivElement> | undefined—Receive activation events. The consumer owns the action performed and its result.
onSelectReact.ReactEventHandler<HTMLDivElement> | undefined—Handle the selection event defined by this part's source signature. DOM text-selection events differ from menu or command activation callbacks.

SidebarGroup

Group related parts while preserving the parent component's required composition.

SidebarGroup props
PropTypeDefaultDescription
inputMode"search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined—Hints at the type of data that might be entered by the user while editing the element or its contents
aria-describedbystring | undefined—Identifies the element (or elements) that describes the object.
aria-invalidboolean | "false" | "true" | "grammar" | "spelling" | undefined—Indicates the entered value does not conform to the format expected by the application.
aria-labelstring | undefined—Defines a string value that labels the current element.
aria-labelledbystring | undefined—Identifies the element (or elements) that labels the current element.
childrenReact.ReactNode—Represents all of the things React can render.
Inherited props (13)
SidebarGroup inherited props
PropTypeDefaultDescription
refReact.Ref<HTMLDivElement> | undefined—Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).
defaultCheckedboolean | undefined—Initial checked state for a control supporting uncontrolled selection. Inherited DOM typing does not give a layout wrapper checkbox behavior.
defaultValuestring | number | readonly string[] | undefined—Initial value for a control supporting uncontrolled state. Inherited DOM typing alone does not give a layout wrapper input behavior.
autoFocusboolean | undefined—Request automatic focus when the element mounts or the primitive opens, according to its source behavior. Choose initial focus deliberately in context.
classNamestring | undefined—Additional classes for this part. Preserve contrast, visible focus and responsive content when adapting styles.
idstring | undefined—Stable DOM identifier used by labels, descriptions or other explicit associations.
roleReact.AriaRole | undefined—Semantic role appropriate to the rendered element. Preserve required relationships and keyboard behavior.
onFocusReact.FocusEventHandler<HTMLDivElement> | undefined—Receive the native focus event. Preserve the component's existing keyboard and focus behavior.
onBlurReact.FocusEventHandler<HTMLDivElement> | undefined—Receive the native blur event when focus leaves this control.
onChangeReact.ChangeEventHandler<HTMLDivElement, Element> | undefined—Receive the native change event; read the actual control value or checked state from its event target.
onKeyDownReact.KeyboardEventHandler<HTMLDivElement> | undefined—Receive keyboard events. Preserve built-in keyboard behavior unless deliberately implementing an accessible alternative.
onClickReact.MouseEventHandler<HTMLDivElement> | undefined—Receive activation events. The consumer owns the action performed and its result.
onSelectReact.ReactEventHandler<HTMLDivElement> | undefined—Handle the selection event defined by this part's source signature. DOM text-selection events differ from menu or command activation callbacks.

SidebarGroupAction

The SidebarGroupAction part of sidebar. Use it with the complete source composition and preserve its required parent context.

SidebarGroupAction props
PropTypeDefaultDescription
inputMode"search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined—Hints at the type of data that might be entered by the user while editing the element or its contents
aria-describedbystring | undefined—Identifies the element (or elements) that describes the object.
aria-invalidboolean | "false" | "true" | "grammar" | "spelling" | undefined—Indicates the entered value does not conform to the format expected by the application.
aria-labelstring | undefined—Defines a string value that labels the current element.
aria-labelledbystring | undefined—Identifies the element (or elements) that labels the current element.
childrenReact.ReactNode—Represents all of the things React can render.
asChildboolean | undefinedfalseMerge this part's props and behavior into one child instead of rendering its default element. Preserve that child's semantics and required accessibility attributes.
Inherited props (18)
SidebarGroupAction inherited props
PropTypeDefaultDescription
refReact.Ref<HTMLButtonElement> | undefined—Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).
disabledboolean | undefined—Make the supported control unavailable through its native or primitive disabled semantics. This does not disable arbitrary child links.
formstring | undefined—ID of the form associated with this control, including when it is rendered outside that form element.
namestring | undefined—Name used by the control's form submission or primitive form integration.
type"button" | "submit" | "reset" | undefined—Native element or primitive mode defined by the source union. Choose a supported value; its meaning depends on the component.
valuestring | number | readonly string[] | undefined—Current value in the shape defined by the source type. For controlled interactive inputs, apply updates from the change callback.
defaultCheckedboolean | undefined—Initial checked state for a control supporting uncontrolled selection. Inherited DOM typing does not give a layout wrapper checkbox behavior.
defaultValuestring | number | readonly string[] | undefined—Initial value for a control supporting uncontrolled state. Inherited DOM typing alone does not give a layout wrapper input behavior.
autoFocusboolean | undefined—Request automatic focus when the element mounts or the primitive opens, according to its source behavior. Choose initial focus deliberately in context.
classNamestring | undefined—Additional classes for this part. Preserve contrast, visible focus and responsive content when adapting styles.
idstring | undefined—Stable DOM identifier used by labels, descriptions or other explicit associations.
roleReact.AriaRole | undefined—Semantic role appropriate to the rendered element. Preserve required relationships and keyboard behavior.
onFocusReact.FocusEventHandler<HTMLButtonElement> | undefined—Receive the native focus event. Preserve the component's existing keyboard and focus behavior.
onBlurReact.FocusEventHandler<HTMLButtonElement> | undefined—Receive the native blur event when focus leaves this control.
onChangeReact.ChangeEventHandler<HTMLButtonElement, Element> | undefined—Receive the native change event; read the actual control value or checked state from its event target.
onKeyDownReact.KeyboardEventHandler<HTMLButtonElement> | undefined—Receive keyboard events. Preserve built-in keyboard behavior unless deliberately implementing an accessible alternative.
onClickReact.MouseEventHandler<HTMLButtonElement> | undefined—Receive activation events. The consumer owns the action performed and its result.
onSelectReact.ReactEventHandler<HTMLButtonElement> | undefined—Handle the selection event defined by this part's source signature. DOM text-selection events differ from menu or command activation callbacks.

SidebarGroupContent

Content region within the root composition. Keep required providers, labels and related controls from the complete example.

SidebarGroupContent props
PropTypeDefaultDescription
inputMode"search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined—Hints at the type of data that might be entered by the user while editing the element or its contents
aria-describedbystring | undefined—Identifies the element (or elements) that describes the object.
aria-invalidboolean | "false" | "true" | "grammar" | "spelling" | undefined—Indicates the entered value does not conform to the format expected by the application.
aria-labelstring | undefined—Defines a string value that labels the current element.
aria-labelledbystring | undefined—Identifies the element (or elements) that labels the current element.
childrenReact.ReactNode—Represents all of the things React can render.
Inherited props (13)
SidebarGroupContent inherited props
PropTypeDefaultDescription
refReact.Ref<HTMLDivElement> | undefined—Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).
defaultCheckedboolean | undefined—Initial checked state for a control supporting uncontrolled selection. Inherited DOM typing does not give a layout wrapper checkbox behavior.
defaultValuestring | number | readonly string[] | undefined—Initial value for a control supporting uncontrolled state. Inherited DOM typing alone does not give a layout wrapper input behavior.
autoFocusboolean | undefined—Request automatic focus when the element mounts or the primitive opens, according to its source behavior. Choose initial focus deliberately in context.
classNamestring | undefined—Additional classes for this part. Preserve contrast, visible focus and responsive content when adapting styles.
idstring | undefined—Stable DOM identifier used by labels, descriptions or other explicit associations.
roleReact.AriaRole | undefined—Semantic role appropriate to the rendered element. Preserve required relationships and keyboard behavior.
onFocusReact.FocusEventHandler<HTMLDivElement> | undefined—Receive the native focus event. Preserve the component's existing keyboard and focus behavior.
onBlurReact.FocusEventHandler<HTMLDivElement> | undefined—Receive the native blur event when focus leaves this control.
onChangeReact.ChangeEventHandler<HTMLDivElement, Element> | undefined—Receive the native change event; read the actual control value or checked state from its event target.
onKeyDownReact.KeyboardEventHandler<HTMLDivElement> | undefined—Receive keyboard events. Preserve built-in keyboard behavior unless deliberately implementing an accessible alternative.
onClickReact.MouseEventHandler<HTMLDivElement> | undefined—Receive activation events. The consumer owns the action performed and its result.
onSelectReact.ReactEventHandler<HTMLDivElement> | undefined—Handle the selection event defined by this part's source signature. DOM text-selection events differ from menu or command activation callbacks.

SidebarGroupLabel

The SidebarGroupLabel part of sidebar. Use it with the complete source composition and preserve its required parent context.

SidebarGroupLabel props
PropTypeDefaultDescription
inputMode"search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined—Hints at the type of data that might be entered by the user while editing the element or its contents
aria-describedbystring | undefined—Identifies the element (or elements) that describes the object.
aria-invalidboolean | "false" | "true" | "grammar" | "spelling" | undefined—Indicates the entered value does not conform to the format expected by the application.
aria-labelstring | undefined—Defines a string value that labels the current element.
aria-labelledbystring | undefined—Identifies the element (or elements) that labels the current element.
childrenReact.ReactNode—Represents all of the things React can render.
asChildboolean | undefinedfalseMerge this part's props and behavior into one child instead of rendering its default element. Preserve that child's semantics and required accessibility attributes.
Inherited props (13)
SidebarGroupLabel inherited props
PropTypeDefaultDescription
refReact.Ref<HTMLDivElement> | undefined—Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).
defaultCheckedboolean | undefined—Initial checked state for a control supporting uncontrolled selection. Inherited DOM typing does not give a layout wrapper checkbox behavior.
defaultValuestring | number | readonly string[] | undefined—Initial value for a control supporting uncontrolled state. Inherited DOM typing alone does not give a layout wrapper input behavior.
autoFocusboolean | undefined—Request automatic focus when the element mounts or the primitive opens, according to its source behavior. Choose initial focus deliberately in context.
classNamestring | undefined—Additional classes for this part. Preserve contrast, visible focus and responsive content when adapting styles.
idstring | undefined—Stable DOM identifier used by labels, descriptions or other explicit associations.
roleReact.AriaRole | undefined—Semantic role appropriate to the rendered element. Preserve required relationships and keyboard behavior.
onFocusReact.FocusEventHandler<HTMLDivElement> | undefined—Receive the native focus event. Preserve the component's existing keyboard and focus behavior.
onBlurReact.FocusEventHandler<HTMLDivElement> | undefined—Receive the native blur event when focus leaves this control.
onChangeReact.ChangeEventHandler<HTMLDivElement, Element> | undefined—Receive the native change event; read the actual control value or checked state from its event target.
onKeyDownReact.KeyboardEventHandler<HTMLDivElement> | undefined—Receive keyboard events. Preserve built-in keyboard behavior unless deliberately implementing an accessible alternative.
onClickReact.MouseEventHandler<HTMLDivElement> | undefined—Receive activation events. The consumer owns the action performed and its result.
onSelectReact.ReactEventHandler<HTMLDivElement> | undefined—Handle the selection event defined by this part's source signature. DOM text-selection events differ from menu or command activation callbacks.

SidebarHeader

Header layout for related title and description content; it does not add application workflow behavior.

SidebarHeader props
PropTypeDefaultDescription
inputMode"search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined—Hints at the type of data that might be entered by the user while editing the element or its contents
aria-describedbystring | undefined—Identifies the element (or elements) that describes the object.
aria-invalidboolean | "false" | "true" | "grammar" | "spelling" | undefined—Indicates the entered value does not conform to the format expected by the application.
aria-labelstring | undefined—Defines a string value that labels the current element.
aria-labelledbystring | undefined—Identifies the element (or elements) that labels the current element.
childrenReact.ReactNode—Represents all of the things React can render.
Inherited props (13)
SidebarHeader inherited props
PropTypeDefaultDescription
refReact.Ref<HTMLDivElement> | undefined—Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).
defaultCheckedboolean | undefined—Initial checked state for a control supporting uncontrolled selection. Inherited DOM typing does not give a layout wrapper checkbox behavior.
defaultValuestring | number | readonly string[] | undefined—Initial value for a control supporting uncontrolled state. Inherited DOM typing alone does not give a layout wrapper input behavior.
autoFocusboolean | undefined—Request automatic focus when the element mounts or the primitive opens, according to its source behavior. Choose initial focus deliberately in context.
classNamestring | undefined—Additional classes for this part. Preserve contrast, visible focus and responsive content when adapting styles.
idstring | undefined—Stable DOM identifier used by labels, descriptions or other explicit associations.
roleReact.AriaRole | undefined—Semantic role appropriate to the rendered element. Preserve required relationships and keyboard behavior.
onFocusReact.FocusEventHandler<HTMLDivElement> | undefined—Receive the native focus event. Preserve the component's existing keyboard and focus behavior.
onBlurReact.FocusEventHandler<HTMLDivElement> | undefined—Receive the native blur event when focus leaves this control.
onChangeReact.ChangeEventHandler<HTMLDivElement, Element> | undefined—Receive the native change event; read the actual control value or checked state from its event target.
onKeyDownReact.KeyboardEventHandler<HTMLDivElement> | undefined—Receive keyboard events. Preserve built-in keyboard behavior unless deliberately implementing an accessible alternative.
onClickReact.MouseEventHandler<HTMLDivElement> | undefined—Receive activation events. The consumer owns the action performed and its result.
onSelectReact.ReactEventHandler<HTMLDivElement> | undefined—Handle the selection event defined by this part's source signature. DOM text-selection events differ from menu or command activation callbacks.

SidebarInput

The SidebarInput part of sidebar. Use it with the complete source composition and preserve its required parent context.

SidebarInput props
PropTypeDefaultDescription
inputMode"search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined—Hints at the type of data that might be entered by the user while editing the element or its contents
aria-describedbystring | undefined—Identifies the element (or elements) that describes the object.
aria-invalidboolean | "false" | "true" | "grammar" | "spelling" | undefined—Indicates the entered value does not conform to the format expected by the application.
aria-labelstring | undefined—Defines a string value that labels the current element.
aria-labelledbystring | undefined—Identifies the element (or elements) that labels the current element.
childrenReact.ReactNode—Represents all of the things React can render.
size"sm" | "md" | "lg" | null | undefined—Control height and text size: sm (36px), md (40px) or lg (48px). Replaces the native size attribute; set width with layout classes. Defaults to md.
Inherited props (32)
SidebarInput inherited props
PropTypeDefaultDescription
formstring | undefined—ID of the form associated with this control, including when it is rendered outside that form element.
patternstring | undefined—Native input validation pattern. Provide readable format guidance and associated validation feedback.
classNamestring | undefined—Additional classes for this part. Preserve contrast, visible focus and responsive content when adapting styles.
refReact.Ref<HTMLInputElement> | undefined—Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).
defaultCheckedboolean | undefined—Initial checked state for a control supporting uncontrolled selection. Inherited DOM typing does not give a layout wrapper checkbox behavior.
defaultValuestring | number | readonly string[] | undefined—Initial value for a control supporting uncontrolled state. Inherited DOM typing alone does not give a layout wrapper input behavior.
autoFocusboolean | undefined—Request automatic focus when the element mounts or the primitive opens, according to its source behavior. Choose initial focus deliberately in context.
idstring | undefined—Stable DOM identifier used by labels, descriptions or other explicit associations.
roleReact.AriaRole | undefined—Semantic role appropriate to the rendered element. Preserve required relationships and keyboard behavior.
onFocusReact.FocusEventHandler<HTMLInputElement> | undefined—Receive the native focus event. Preserve the component's existing keyboard and focus behavior.
onBlurReact.FocusEventHandler<HTMLInputElement> | undefined—Receive the native blur event when focus leaves this control.
onChangeReact.ChangeEventHandler<HTMLInputElement, HTMLInputElement> | undefined—Receive the native change event; read the actual control value or checked state from its event target.
onKeyDownReact.KeyboardEventHandler<HTMLInputElement> | undefined—Receive keyboard events. Preserve built-in keyboard behavior unless deliberately implementing an accessible alternative.
onClickReact.MouseEventHandler<HTMLInputElement> | undefined—Receive activation events. The consumer owns the action performed and its result.
onSelectReact.ReactEventHandler<HTMLInputElement> | undefined—Handle the selection event defined by this part's source signature. DOM text-selection events differ from menu or command activation callbacks.
altstring | undefined—Text alternative for the image. Identify informative images; use an empty alternative only when the image is genuinely decorative.
srcstring | undefined—Image source URL. Supply alternative text appropriate to whether the image conveys identity or is decorative.
disabledboolean | undefined—Make the supported control unavailable through its native or primitive disabled semantics. This does not disable arbitrary child links.
namestring | undefined—Name used by the control's form submission or primitive form integration.
typeReact.HTMLInputTypeAttribute | undefined—Native element or primitive mode defined by the source union. Choose a supported value; its meaning depends on the component.
valuestring | number | readonly string[] | undefined—Current value in the shape defined by the source type. For controlled interactive inputs, apply updates from the change callback.
multipleboolean | undefined—Allow multiple values where the native element or primitive supports them, using its source-defined value shape.
checkedboolean | undefined—Current checked state. Apply the requested value from onCheckedChange when the parent owns this state.
autoCompleteReact.HTMLInputAutoCompleteAttribute | undefined—Native autocomplete hint appropriate to the field's actual purpose.
maxstring | number | undefined—Maximum supported numeric value.
maxLengthnumber | undefined—Maximum allowed text length for native input or code entry.
minstring | number | undefined—Minimum supported numeric value.
minLengthnumber | undefined—Minimum allowed text length for native validation.
placeholderstring | undefined—Prompt shown before a value is selected or entered. Supply an accessible label separately.
readOnlyboolean | undefined—Prevent value editing while preserving readable content. Read-only behavior differs from disabled behavior.
requiredboolean | undefined—Mark this control as required using its native or primitive semantics. Consumers own contextual validation feedback.
stepstring | number | undefined—Numeric increment used for slider or native input changes.

SidebarInset

The SidebarInset part of sidebar. Use it with the complete source composition and preserve its required parent context.

SidebarInset props
PropTypeDefaultDescription
inputMode"search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined—Hints at the type of data that might be entered by the user while editing the element or its contents
aria-describedbystring | undefined—Identifies the element (or elements) that describes the object.
aria-invalidboolean | "false" | "true" | "grammar" | "spelling" | undefined—Indicates the entered value does not conform to the format expected by the application.
aria-labelstring | undefined—Defines a string value that labels the current element.
aria-labelledbystring | undefined—Identifies the element (or elements) that labels the current element.
childrenReact.ReactNode—Represents all of the things React can render.
asChildboolean | undefinedfalseMerge this part's props and behavior into one child instead of rendering its default element. Preserve that child's semantics and required accessibility attributes.
Inherited props (13)
SidebarInset inherited props
PropTypeDefaultDescription
refReact.Ref<HTMLElement> | undefined—Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).
defaultCheckedboolean | undefined—Initial checked state for a control supporting uncontrolled selection. Inherited DOM typing does not give a layout wrapper checkbox behavior.
defaultValuestring | number | readonly string[] | undefined—Initial value for a control supporting uncontrolled state. Inherited DOM typing alone does not give a layout wrapper input behavior.
autoFocusboolean | undefined—Request automatic focus when the element mounts or the primitive opens, according to its source behavior. Choose initial focus deliberately in context.
classNamestring | undefined—Additional classes for this part. Preserve contrast, visible focus and responsive content when adapting styles.
idstring | undefined—Stable DOM identifier used by labels, descriptions or other explicit associations.
roleReact.AriaRole | undefined—Semantic role appropriate to the rendered element. Preserve required relationships and keyboard behavior.
onFocusReact.FocusEventHandler<HTMLElement> | undefined—Receive the native focus event. Preserve the component's existing keyboard and focus behavior.
onBlurReact.FocusEventHandler<HTMLElement> | undefined—Receive the native blur event when focus leaves this control.
onChangeReact.ChangeEventHandler<HTMLElement, Element> | undefined—Receive the native change event; read the actual control value or checked state from its event target.
onKeyDownReact.KeyboardEventHandler<HTMLElement> | undefined—Receive keyboard events. Preserve built-in keyboard behavior unless deliberately implementing an accessible alternative.
onClickReact.MouseEventHandler<HTMLElement> | undefined—Receive activation events. The consumer owns the action performed and its result.
onSelectReact.ReactEventHandler<HTMLElement> | undefined—Handle the selection event defined by this part's source signature. DOM text-selection events differ from menu or command activation callbacks.

SidebarMenu

The SidebarMenu part of sidebar. Use it with the complete source composition and preserve its required parent context.

SidebarMenu props
PropTypeDefaultDescription
inputMode"search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined—Hints at the type of data that might be entered by the user while editing the element or its contents
aria-describedbystring | undefined—Identifies the element (or elements) that describes the object.
aria-invalidboolean | "false" | "true" | "grammar" | "spelling" | undefined—Indicates the entered value does not conform to the format expected by the application.
aria-labelstring | undefined—Defines a string value that labels the current element.
aria-labelledbystring | undefined—Identifies the element (or elements) that labels the current element.
childrenReact.ReactNode—Represents all of the things React can render.
Inherited props (13)
SidebarMenu inherited props
PropTypeDefaultDescription
refReact.Ref<HTMLUListElement> | undefined—Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).
defaultCheckedboolean | undefined—Initial checked state for a control supporting uncontrolled selection. Inherited DOM typing does not give a layout wrapper checkbox behavior.
defaultValuestring | number | readonly string[] | undefined—Initial value for a control supporting uncontrolled state. Inherited DOM typing alone does not give a layout wrapper input behavior.
autoFocusboolean | undefined—Request automatic focus when the element mounts or the primitive opens, according to its source behavior. Choose initial focus deliberately in context.
classNamestring | undefined—Additional classes for this part. Preserve contrast, visible focus and responsive content when adapting styles.
idstring | undefined—Stable DOM identifier used by labels, descriptions or other explicit associations.
roleReact.AriaRole | undefined—Semantic role appropriate to the rendered element. Preserve required relationships and keyboard behavior.
onFocusReact.FocusEventHandler<HTMLUListElement> | undefined—Receive the native focus event. Preserve the component's existing keyboard and focus behavior.
onBlurReact.FocusEventHandler<HTMLUListElement> | undefined—Receive the native blur event when focus leaves this control.
onChangeReact.ChangeEventHandler<HTMLUListElement, Element> | undefined—Receive the native change event; read the actual control value or checked state from its event target.
onKeyDownReact.KeyboardEventHandler<HTMLUListElement> | undefined—Receive keyboard events. Preserve built-in keyboard behavior unless deliberately implementing an accessible alternative.
onClickReact.MouseEventHandler<HTMLUListElement> | undefined—Receive activation events. The consumer owns the action performed and its result.
onSelectReact.ReactEventHandler<HTMLUListElement> | undefined—Handle the selection event defined by this part's source signature. DOM text-selection events differ from menu or command activation callbacks.

SidebarMenuAction

The SidebarMenuAction part of sidebar. Use it with the complete source composition and preserve its required parent context.

SidebarMenuAction props
PropTypeDefaultDescription
inputMode"search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined—Hints at the type of data that might be entered by the user while editing the element or its contents
aria-describedbystring | undefined—Identifies the element (or elements) that describes the object.
aria-invalidboolean | "false" | "true" | "grammar" | "spelling" | undefined—Indicates the entered value does not conform to the format expected by the application.
aria-labelstring | undefined—Defines a string value that labels the current element.
aria-labelledbystring | undefined—Identifies the element (or elements) that labels the current element.
childrenReact.ReactNode—Represents all of the things React can render.
asChildboolean | undefinedfalseMerge this part's props and behavior into one child instead of rendering its default element. Preserve that child's semantics and required accessibility attributes.
showOnHoverboolean | undefinedfalseReveal this menu action on hover/focus or while its menu is open, rather than displaying it persistently.
Inherited props (18)
SidebarMenuAction inherited props
PropTypeDefaultDescription
refReact.Ref<HTMLButtonElement> | undefined—Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).
disabledboolean | undefined—Make the supported control unavailable through its native or primitive disabled semantics. This does not disable arbitrary child links.
formstring | undefined—ID of the form associated with this control, including when it is rendered outside that form element.
namestring | undefined—Name used by the control's form submission or primitive form integration.
type"button" | "submit" | "reset" | undefined—Native element or primitive mode defined by the source union. Choose a supported value; its meaning depends on the component.
valuestring | number | readonly string[] | undefined—Current value in the shape defined by the source type. For controlled interactive inputs, apply updates from the change callback.
defaultCheckedboolean | undefined—Initial checked state for a control supporting uncontrolled selection. Inherited DOM typing does not give a layout wrapper checkbox behavior.
defaultValuestring | number | readonly string[] | undefined—Initial value for a control supporting uncontrolled state. Inherited DOM typing alone does not give a layout wrapper input behavior.
autoFocusboolean | undefined—Request automatic focus when the element mounts or the primitive opens, according to its source behavior. Choose initial focus deliberately in context.
classNamestring | undefined—Additional classes for this part. Preserve contrast, visible focus and responsive content when adapting styles.
idstring | undefined—Stable DOM identifier used by labels, descriptions or other explicit associations.
roleReact.AriaRole | undefined—Semantic role appropriate to the rendered element. Preserve required relationships and keyboard behavior.
onFocusReact.FocusEventHandler<HTMLButtonElement> | undefined—Receive the native focus event. Preserve the component's existing keyboard and focus behavior.
onBlurReact.FocusEventHandler<HTMLButtonElement> | undefined—Receive the native blur event when focus leaves this control.
onChangeReact.ChangeEventHandler<HTMLButtonElement, Element> | undefined—Receive the native change event; read the actual control value or checked state from its event target.
onKeyDownReact.KeyboardEventHandler<HTMLButtonElement> | undefined—Receive keyboard events. Preserve built-in keyboard behavior unless deliberately implementing an accessible alternative.
onClickReact.MouseEventHandler<HTMLButtonElement> | undefined—Receive activation events. The consumer owns the action performed and its result.
onSelectReact.ReactEventHandler<HTMLButtonElement> | undefined—Handle the selection event defined by this part's source signature. DOM text-selection events differ from menu or command activation callbacks.

SidebarMenuBadge

The SidebarMenuBadge part of sidebar. Use it with the complete source composition and preserve its required parent context.

SidebarMenuBadge props
PropTypeDefaultDescription
inputMode"search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined—Hints at the type of data that might be entered by the user while editing the element or its contents
aria-describedbystring | undefined—Identifies the element (or elements) that describes the object.
aria-invalidboolean | "false" | "true" | "grammar" | "spelling" | undefined—Indicates the entered value does not conform to the format expected by the application.
aria-labelstring | undefined—Defines a string value that labels the current element.
aria-labelledbystring | undefined—Identifies the element (or elements) that labels the current element.
childrenReact.ReactNode—Represents all of the things React can render.
Inherited props (13)
SidebarMenuBadge inherited props
PropTypeDefaultDescription
refReact.Ref<HTMLDivElement> | undefined—Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).
defaultCheckedboolean | undefined—Initial checked state for a control supporting uncontrolled selection. Inherited DOM typing does not give a layout wrapper checkbox behavior.
defaultValuestring | number | readonly string[] | undefined—Initial value for a control supporting uncontrolled state. Inherited DOM typing alone does not give a layout wrapper input behavior.
autoFocusboolean | undefined—Request automatic focus when the element mounts or the primitive opens, according to its source behavior. Choose initial focus deliberately in context.
classNamestring | undefined—Additional classes for this part. Preserve contrast, visible focus and responsive content when adapting styles.
idstring | undefined—Stable DOM identifier used by labels, descriptions or other explicit associations.
roleReact.AriaRole | undefined—Semantic role appropriate to the rendered element. Preserve required relationships and keyboard behavior.
onFocusReact.FocusEventHandler<HTMLDivElement> | undefined—Receive the native focus event. Preserve the component's existing keyboard and focus behavior.
onBlurReact.FocusEventHandler<HTMLDivElement> | undefined—Receive the native blur event when focus leaves this control.
onChangeReact.ChangeEventHandler<HTMLDivElement, Element> | undefined—Receive the native change event; read the actual control value or checked state from its event target.
onKeyDownReact.KeyboardEventHandler<HTMLDivElement> | undefined—Receive keyboard events. Preserve built-in keyboard behavior unless deliberately implementing an accessible alternative.
onClickReact.MouseEventHandler<HTMLDivElement> | undefined—Receive activation events. The consumer owns the action performed and its result.
onSelectReact.ReactEventHandler<HTMLDivElement> | undefined—Handle the selection event defined by this part's source signature. DOM text-selection events differ from menu or command activation callbacks.

SidebarMenuButton

The SidebarMenuButton part of sidebar. Use it with the complete source composition and preserve its required parent context.

SidebarMenuButton props
PropTypeDefaultDescription
inputMode"search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined—Hints at the type of data that might be entered by the user while editing the element or its contents
aria-describedbystring | undefined—Identifies the element (or elements) that describes the object.
aria-invalidboolean | "false" | "true" | "grammar" | "spelling" | undefined—Indicates the entered value does not conform to the format expected by the application.
aria-labelstring | undefined—Defines a string value that labels the current element.
aria-labelledbystring | undefined—Identifies the element (or elements) that labels the current element.
childrenReact.ReactNode—Represents all of the things React can render.
size"sm" | "md" | "lg" | null | undefined"md"Visual size of this part. Choose a supported size while preserving readable content and usable interaction targets.
isActiveboolean | undefinedfalseMark this item as the current destination or active item. Keep its state consistent with the consuming application's actual selection.
asChildboolean | undefinedfalseMerge this part's props and behavior into one child instead of rendering its default element. Preserve that child's semantics and required accessibility attributes.
tooltipstring | undefined—Text displayed for the collapsed sidebar menu button. The button still needs a meaningful accessible name.
Inherited props (18)
SidebarMenuButton inherited props
PropTypeDefaultDescription
refReact.Ref<HTMLButtonElement> | undefined—Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).
disabledboolean | undefined—Make the supported control unavailable through its native or primitive disabled semantics. This does not disable arbitrary child links.
formstring | undefined—ID of the form associated with this control, including when it is rendered outside that form element.
namestring | undefined—Name used by the control's form submission or primitive form integration.
type"button" | "submit" | "reset" | undefined—Native element or primitive mode defined by the source union. Choose a supported value; its meaning depends on the component.
valuestring | number | readonly string[] | undefined—Current value in the shape defined by the source type. For controlled interactive inputs, apply updates from the change callback.
defaultCheckedboolean | undefined—Initial checked state for a control supporting uncontrolled selection. Inherited DOM typing does not give a layout wrapper checkbox behavior.
defaultValuestring | number | readonly string[] | undefined—Initial value for a control supporting uncontrolled state. Inherited DOM typing alone does not give a layout wrapper input behavior.
autoFocusboolean | undefined—Request automatic focus when the element mounts or the primitive opens, according to its source behavior. Choose initial focus deliberately in context.
classNamestring | undefined—Additional classes for this part. Preserve contrast, visible focus and responsive content when adapting styles.
idstring | undefined—Stable DOM identifier used by labels, descriptions or other explicit associations.
roleReact.AriaRole | undefined—Semantic role appropriate to the rendered element. Preserve required relationships and keyboard behavior.
onFocusReact.FocusEventHandler<HTMLButtonElement> | undefined—Receive the native focus event. Preserve the component's existing keyboard and focus behavior.
onBlurReact.FocusEventHandler<HTMLButtonElement> | undefined—Receive the native blur event when focus leaves this control.
onChangeReact.ChangeEventHandler<HTMLButtonElement, Element> | undefined—Receive the native change event; read the actual control value or checked state from its event target.
onKeyDownReact.KeyboardEventHandler<HTMLButtonElement> | undefined—Receive keyboard events. Preserve built-in keyboard behavior unless deliberately implementing an accessible alternative.
onClickReact.MouseEventHandler<HTMLButtonElement> | undefined—Receive activation events. The consumer owns the action performed and its result.
onSelectReact.ReactEventHandler<HTMLButtonElement> | undefined—Handle the selection event defined by this part's source signature. DOM text-selection events differ from menu or command activation callbacks.

SidebarMenuItem

One item within its parent composition. Keep parent context and the value, label or state required by the source API.

SidebarMenuItem props
PropTypeDefaultDescription
inputMode"search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined—Hints at the type of data that might be entered by the user while editing the element or its contents
aria-describedbystring | undefined—Identifies the element (or elements) that describes the object.
aria-invalidboolean | "false" | "true" | "grammar" | "spelling" | undefined—Indicates the entered value does not conform to the format expected by the application.
aria-labelstring | undefined—Defines a string value that labels the current element.
aria-labelledbystring | undefined—Identifies the element (or elements) that labels the current element.
childrenReact.ReactNode—Represents all of the things React can render.
Inherited props (14)
SidebarMenuItem inherited props
PropTypeDefaultDescription
refReact.Ref<HTMLLIElement> | undefined—Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).
valuestring | number | readonly string[] | undefined—Current value in the shape defined by the source type. For controlled interactive inputs, apply updates from the change callback.
defaultCheckedboolean | undefined—Initial checked state for a control supporting uncontrolled selection. Inherited DOM typing does not give a layout wrapper checkbox behavior.
defaultValuestring | number | readonly string[] | undefined—Initial value for a control supporting uncontrolled state. Inherited DOM typing alone does not give a layout wrapper input behavior.
autoFocusboolean | undefined—Request automatic focus when the element mounts or the primitive opens, according to its source behavior. Choose initial focus deliberately in context.
classNamestring | undefined—Additional classes for this part. Preserve contrast, visible focus and responsive content when adapting styles.
idstring | undefined—Stable DOM identifier used by labels, descriptions or other explicit associations.
roleReact.AriaRole | undefined—Semantic role appropriate to the rendered element. Preserve required relationships and keyboard behavior.
onFocusReact.FocusEventHandler<HTMLLIElement> | undefined—Receive the native focus event. Preserve the component's existing keyboard and focus behavior.
onBlurReact.FocusEventHandler<HTMLLIElement> | undefined—Receive the native blur event when focus leaves this control.
onChangeReact.ChangeEventHandler<HTMLLIElement, Element> | undefined—Receive the native change event; read the actual control value or checked state from its event target.
onKeyDownReact.KeyboardEventHandler<HTMLLIElement> | undefined—Receive keyboard events. Preserve built-in keyboard behavior unless deliberately implementing an accessible alternative.
onClickReact.MouseEventHandler<HTMLLIElement> | undefined—Receive activation events. The consumer owns the action performed and its result.
onSelectReact.ReactEventHandler<HTMLLIElement> | undefined—Handle the selection event defined by this part's source signature. DOM text-selection events differ from menu or command activation callbacks.

SidebarMenuSkeleton

The SidebarMenuSkeleton part of sidebar. Use it with the complete source composition and preserve its required parent context.

SidebarMenuSkeleton props
PropTypeDefaultDescription
inputMode"search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined—Hints at the type of data that might be entered by the user while editing the element or its contents
aria-describedbystring | undefined—Identifies the element (or elements) that describes the object.
aria-invalidboolean | "false" | "true" | "grammar" | "spelling" | undefined—Indicates the entered value does not conform to the format expected by the application.
aria-labelstring | undefined—Defines a string value that labels the current element.
aria-labelledbystring | undefined—Identifies the element (or elements) that labels the current element.
childrenReact.ReactNode—Represents all of the things React can render.
showIconboolean | undefinedfalseInclude an icon placeholder in the sidebar skeleton so its layout matches the loading menu item.
Inherited props (13)
SidebarMenuSkeleton inherited props
PropTypeDefaultDescription
refReact.Ref<HTMLDivElement> | undefined—Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).
defaultCheckedboolean | undefined—Initial checked state for a control supporting uncontrolled selection. Inherited DOM typing does not give a layout wrapper checkbox behavior.
defaultValuestring | number | readonly string[] | undefined—Initial value for a control supporting uncontrolled state. Inherited DOM typing alone does not give a layout wrapper input behavior.
autoFocusboolean | undefined—Request automatic focus when the element mounts or the primitive opens, according to its source behavior. Choose initial focus deliberately in context.
classNamestring | undefined—Additional classes for this part. Preserve contrast, visible focus and responsive content when adapting styles.
idstring | undefined—Stable DOM identifier used by labels, descriptions or other explicit associations.
roleReact.AriaRole | undefined—Semantic role appropriate to the rendered element. Preserve required relationships and keyboard behavior.
onFocusReact.FocusEventHandler<HTMLDivElement> | undefined—Receive the native focus event. Preserve the component's existing keyboard and focus behavior.
onBlurReact.FocusEventHandler<HTMLDivElement> | undefined—Receive the native blur event when focus leaves this control.
onChangeReact.ChangeEventHandler<HTMLDivElement, Element> | undefined—Receive the native change event; read the actual control value or checked state from its event target.
onKeyDownReact.KeyboardEventHandler<HTMLDivElement> | undefined—Receive keyboard events. Preserve built-in keyboard behavior unless deliberately implementing an accessible alternative.
onClickReact.MouseEventHandler<HTMLDivElement> | undefined—Receive activation events. The consumer owns the action performed and its result.
onSelectReact.ReactEventHandler<HTMLDivElement> | undefined—Handle the selection event defined by this part's source signature. DOM text-selection events differ from menu or command activation callbacks.

SidebarMenuSub

The SidebarMenuSub part of sidebar. Use it with the complete source composition and preserve its required parent context.

SidebarMenuSub props
PropTypeDefaultDescription
inputMode"search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined—Hints at the type of data that might be entered by the user while editing the element or its contents
aria-describedbystring | undefined—Identifies the element (or elements) that describes the object.
aria-invalidboolean | "false" | "true" | "grammar" | "spelling" | undefined—Indicates the entered value does not conform to the format expected by the application.
aria-labelstring | undefined—Defines a string value that labels the current element.
aria-labelledbystring | undefined—Identifies the element (or elements) that labels the current element.
childrenReact.ReactNode—Represents all of the things React can render.
Inherited props (13)
SidebarMenuSub inherited props
PropTypeDefaultDescription
refReact.Ref<HTMLUListElement> | undefined—Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).
defaultCheckedboolean | undefined—Initial checked state for a control supporting uncontrolled selection. Inherited DOM typing does not give a layout wrapper checkbox behavior.
defaultValuestring | number | readonly string[] | undefined—Initial value for a control supporting uncontrolled state. Inherited DOM typing alone does not give a layout wrapper input behavior.
autoFocusboolean | undefined—Request automatic focus when the element mounts or the primitive opens, according to its source behavior. Choose initial focus deliberately in context.
classNamestring | undefined—Additional classes for this part. Preserve contrast, visible focus and responsive content when adapting styles.
idstring | undefined—Stable DOM identifier used by labels, descriptions or other explicit associations.
roleReact.AriaRole | undefined—Semantic role appropriate to the rendered element. Preserve required relationships and keyboard behavior.
onFocusReact.FocusEventHandler<HTMLUListElement> | undefined—Receive the native focus event. Preserve the component's existing keyboard and focus behavior.
onBlurReact.FocusEventHandler<HTMLUListElement> | undefined—Receive the native blur event when focus leaves this control.
onChangeReact.ChangeEventHandler<HTMLUListElement, Element> | undefined—Receive the native change event; read the actual control value or checked state from its event target.
onKeyDownReact.KeyboardEventHandler<HTMLUListElement> | undefined—Receive keyboard events. Preserve built-in keyboard behavior unless deliberately implementing an accessible alternative.
onClickReact.MouseEventHandler<HTMLUListElement> | undefined—Receive activation events. The consumer owns the action performed and its result.
onSelectReact.ReactEventHandler<HTMLUListElement> | undefined—Handle the selection event defined by this part's source signature. DOM text-selection events differ from menu or command activation callbacks.

SidebarMenuSubButton

The SidebarMenuSubButton part of sidebar. Use it with the complete source composition and preserve its required parent context.

SidebarMenuSubButton props
PropTypeDefaultDescription
inputMode"search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined—Hints at the type of data that might be entered by the user while editing the element or its contents
aria-describedbystring | undefined—Identifies the element (or elements) that describes the object.
aria-invalidboolean | "false" | "true" | "grammar" | "spelling" | undefined—Indicates the entered value does not conform to the format expected by the application.
aria-labelstring | undefined—Defines a string value that labels the current element.
aria-labelledbystring | undefined—Identifies the element (or elements) that labels the current element.
childrenReact.ReactNode—Represents all of the things React can render.
isActiveboolean | undefinedfalseMark this item as the current destination or active item. Keep its state consistent with the consuming application's actual selection.
asChildboolean | undefinedfalseMerge this part's props and behavior into one child instead of rendering its default element. Preserve that child's semantics and required accessibility attributes.
size"sm" | "md" | undefined"md"Visual size of this part. Choose a supported size while preserving readable content and usable interaction targets.
Inherited props (14)
SidebarMenuSubButton inherited props
PropTypeDefaultDescription
refReact.Ref<HTMLAnchorElement> | undefined—Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).
typestring | undefined—Native element or primitive mode defined by the source union. Choose a supported value; its meaning depends on the component.
defaultCheckedboolean | undefined—Initial checked state for a control supporting uncontrolled selection. Inherited DOM typing does not give a layout wrapper checkbox behavior.
defaultValuestring | number | readonly string[] | undefined—Initial value for a control supporting uncontrolled state. Inherited DOM typing alone does not give a layout wrapper input behavior.
autoFocusboolean | undefined—Request automatic focus when the element mounts or the primitive opens, according to its source behavior. Choose initial focus deliberately in context.
classNamestring | undefined—Additional classes for this part. Preserve contrast, visible focus and responsive content when adapting styles.
idstring | undefined—Stable DOM identifier used by labels, descriptions or other explicit associations.
roleReact.AriaRole | undefined—Semantic role appropriate to the rendered element. Preserve required relationships and keyboard behavior.
onFocusReact.FocusEventHandler<HTMLAnchorElement> | undefined—Receive the native focus event. Preserve the component's existing keyboard and focus behavior.
onBlurReact.FocusEventHandler<HTMLAnchorElement> | undefined—Receive the native blur event when focus leaves this control.
onChangeReact.ChangeEventHandler<HTMLAnchorElement, Element> | undefined—Receive the native change event; read the actual control value or checked state from its event target.
onKeyDownReact.KeyboardEventHandler<HTMLAnchorElement> | undefined—Receive keyboard events. Preserve built-in keyboard behavior unless deliberately implementing an accessible alternative.
onClickReact.MouseEventHandler<HTMLAnchorElement> | undefined—Receive activation events. The consumer owns the action performed and its result.
onSelectReact.ReactEventHandler<HTMLAnchorElement> | undefined—Handle the selection event defined by this part's source signature. DOM text-selection events differ from menu or command activation callbacks.

SidebarMenuSubItem

One item within its parent composition. Keep parent context and the value, label or state required by the source API.

SidebarMenuSubItem props
PropTypeDefaultDescription
inputMode"search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined—Hints at the type of data that might be entered by the user while editing the element or its contents
aria-describedbystring | undefined—Identifies the element (or elements) that describes the object.
aria-invalidboolean | "false" | "true" | "grammar" | "spelling" | undefined—Indicates the entered value does not conform to the format expected by the application.
aria-labelstring | undefined—Defines a string value that labels the current element.
aria-labelledbystring | undefined—Identifies the element (or elements) that labels the current element.
childrenReact.ReactNode—Represents all of the things React can render.
Inherited props (14)
SidebarMenuSubItem inherited props
PropTypeDefaultDescription
refReact.Ref<HTMLLIElement> | undefined—Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).
valuestring | number | readonly string[] | undefined—Current value in the shape defined by the source type. For controlled interactive inputs, apply updates from the change callback.
defaultCheckedboolean | undefined—Initial checked state for a control supporting uncontrolled selection. Inherited DOM typing does not give a layout wrapper checkbox behavior.
defaultValuestring | number | readonly string[] | undefined—Initial value for a control supporting uncontrolled state. Inherited DOM typing alone does not give a layout wrapper input behavior.
autoFocusboolean | undefined—Request automatic focus when the element mounts or the primitive opens, according to its source behavior. Choose initial focus deliberately in context.
classNamestring | undefined—Additional classes for this part. Preserve contrast, visible focus and responsive content when adapting styles.
idstring | undefined—Stable DOM identifier used by labels, descriptions or other explicit associations.
roleReact.AriaRole | undefined—Semantic role appropriate to the rendered element. Preserve required relationships and keyboard behavior.
onFocusReact.FocusEventHandler<HTMLLIElement> | undefined—Receive the native focus event. Preserve the component's existing keyboard and focus behavior.
onBlurReact.FocusEventHandler<HTMLLIElement> | undefined—Receive the native blur event when focus leaves this control.
onChangeReact.ChangeEventHandler<HTMLLIElement, Element> | undefined—Receive the native change event; read the actual control value or checked state from its event target.
onKeyDownReact.KeyboardEventHandler<HTMLLIElement> | undefined—Receive keyboard events. Preserve built-in keyboard behavior unless deliberately implementing an accessible alternative.
onClickReact.MouseEventHandler<HTMLLIElement> | undefined—Receive activation events. The consumer owns the action performed and its result.
onSelectReact.ReactEventHandler<HTMLLIElement> | undefined—Handle the selection event defined by this part's source signature. DOM text-selection events differ from menu or command activation callbacks.

SidebarProvider

The provider owns the open state and the widths, and it lays the shell out with flexbox rather than fixed positioning. That is the one deliberate difference from the usual implementation: a flex shell also works inside a card or a preview frame, not only as a whole page.

SidebarProvider props
PropTypeDefaultDescription
inputMode"search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined—Hints at the type of data that might be entered by the user while editing the element or its contents
aria-describedbystring | undefined—Identifies the element (or elements) that describes the object.
aria-invalidboolean | "false" | "true" | "grammar" | "spelling" | undefined—Indicates the entered value does not conform to the format expected by the application.
aria-labelstring | undefined—Defines a string value that labels the current element.
aria-labelledbystring | undefined—Identifies the element (or elements) that labels the current element.
childrenReact.ReactNode—Represents all of the things React can render.
defaultOpenboolean | undefinedtrueInitial uncontrolled open state. Use open with onOpenChange when the parent owns subsequent changes.
openboolean | undefined—Controlled open state. Update it through the corresponding change callback to keep the UI interactive.
onOpenChange((open: boolean) => void) | undefined—Called with the requested open state. A controlled parent must apply that value to open.
Inherited props (13)
SidebarProvider inherited props
PropTypeDefaultDescription
refReact.Ref<HTMLDivElement> | undefined—Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).
defaultCheckedboolean | undefined—Initial checked state for a control supporting uncontrolled selection. Inherited DOM typing does not give a layout wrapper checkbox behavior.
defaultValuestring | number | readonly string[] | undefined—Initial value for a control supporting uncontrolled state. Inherited DOM typing alone does not give a layout wrapper input behavior.
autoFocusboolean | undefined—Request automatic focus when the element mounts or the primitive opens, according to its source behavior. Choose initial focus deliberately in context.
classNamestring | undefined—Additional classes for this part. Preserve contrast, visible focus and responsive content when adapting styles.
idstring | undefined—Stable DOM identifier used by labels, descriptions or other explicit associations.
roleReact.AriaRole | undefined—Semantic role appropriate to the rendered element. Preserve required relationships and keyboard behavior.
onFocusReact.FocusEventHandler<HTMLDivElement> | undefined—Receive the native focus event. Preserve the component's existing keyboard and focus behavior.
onBlurReact.FocusEventHandler<HTMLDivElement> | undefined—Receive the native blur event when focus leaves this control.
onChangeReact.ChangeEventHandler<HTMLDivElement, Element> | undefined—Receive the native change event; read the actual control value or checked state from its event target.
onKeyDownReact.KeyboardEventHandler<HTMLDivElement> | undefined—Receive keyboard events. Preserve built-in keyboard behavior unless deliberately implementing an accessible alternative.
onClickReact.MouseEventHandler<HTMLDivElement> | undefined—Receive activation events. The consumer owns the action performed and its result.
onSelectReact.ReactEventHandler<HTMLDivElement> | undefined—Handle the selection event defined by this part's source signature. DOM text-selection events differ from menu or command activation callbacks.

SidebarRail

The thin strip along the sidebar's edge. Clicking anywhere on it toggles, which is a much larger target than the icon in the header.

SidebarRail props
PropTypeDefaultDescription
inputMode"search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined—Hints at the type of data that might be entered by the user while editing the element or its contents
aria-describedbystring | undefined—Identifies the element (or elements) that describes the object.
aria-invalidboolean | "false" | "true" | "grammar" | "spelling" | undefined—Indicates the entered value does not conform to the format expected by the application.
aria-labelstring | undefined—Defines a string value that labels the current element.
aria-labelledbystring | undefined—Identifies the element (or elements) that labels the current element.
childrenReact.ReactNode—Represents all of the things React can render.
Inherited props (18)
SidebarRail inherited props
PropTypeDefaultDescription
refReact.Ref<HTMLButtonElement> | undefined—Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).
disabledboolean | undefined—Make the supported control unavailable through its native or primitive disabled semantics. This does not disable arbitrary child links.
formstring | undefined—ID of the form associated with this control, including when it is rendered outside that form element.
namestring | undefined—Name used by the control's form submission or primitive form integration.
type"button" | "submit" | "reset" | undefined—Native element or primitive mode defined by the source union. Choose a supported value; its meaning depends on the component.
valuestring | number | readonly string[] | undefined—Current value in the shape defined by the source type. For controlled interactive inputs, apply updates from the change callback.
defaultCheckedboolean | undefined—Initial checked state for a control supporting uncontrolled selection. Inherited DOM typing does not give a layout wrapper checkbox behavior.
defaultValuestring | number | readonly string[] | undefined—Initial value for a control supporting uncontrolled state. Inherited DOM typing alone does not give a layout wrapper input behavior.
autoFocusboolean | undefined—Request automatic focus when the element mounts or the primitive opens, according to its source behavior. Choose initial focus deliberately in context.
classNamestring | undefined—Additional classes for this part. Preserve contrast, visible focus and responsive content when adapting styles.
idstring | undefined—Stable DOM identifier used by labels, descriptions or other explicit associations.
roleReact.AriaRole | undefined—Semantic role appropriate to the rendered element. Preserve required relationships and keyboard behavior.
onFocusReact.FocusEventHandler<HTMLButtonElement> | undefined—Receive the native focus event. Preserve the component's existing keyboard and focus behavior.
onBlurReact.FocusEventHandler<HTMLButtonElement> | undefined—Receive the native blur event when focus leaves this control.
onChangeReact.ChangeEventHandler<HTMLButtonElement, Element> | undefined—Receive the native change event; read the actual control value or checked state from its event target.
onKeyDownReact.KeyboardEventHandler<HTMLButtonElement> | undefined—Receive keyboard events. Preserve built-in keyboard behavior unless deliberately implementing an accessible alternative.
onClickReact.MouseEventHandler<HTMLButtonElement> | undefined—Receive activation events. The consumer owns the action performed and its result.
onSelectReact.ReactEventHandler<HTMLButtonElement> | undefined—Handle the selection event defined by this part's source signature. DOM text-selection events differ from menu or command activation callbacks.

SidebarSeparator

Visual or semantic separation between adjacent items. It is not an operable item.

SidebarSeparator props
PropTypeDefaultDescription
orientation("horizontal" | "vertical") | undefined—Either vertical or horizontal. Defaults to horizontal.
decorativeboolean | undefined—Whether or not the component is purely decorative. When true, accessibility-related attributes are updated so that the rendered element is removed from the accessibility tree.
inputMode"search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined—Hints at the type of data that might be entered by the user while editing the element or its contents
aria-describedbystring | undefined—Identifies the element (or elements) that describes the object.
aria-invalidboolean | "false" | "true" | "grammar" | "spelling" | undefined—Indicates the entered value does not conform to the format expected by the application.
aria-labelstring | undefined—Defines a string value that labels the current element.
aria-labelledbystring | undefined—Identifies the element (or elements) that labels the current element.
childrenReact.ReactNode—Represents all of the things React can render.
labelReact.ReactNode—Short text centered between two lines, such as "or" or a date. Horizontal only; the text stays readable by assistive technology while the lines remain decorative unless decorative is false.
Inherited props (14)
SidebarSeparator inherited props
PropTypeDefaultDescription
classNamestring | undefined—Additional classes for this part. Preserve contrast, visible focus and responsive content when adapting styles.
defaultCheckedboolean | undefined—Initial checked state for a control supporting uncontrolled selection. Inherited DOM typing does not give a layout wrapper checkbox behavior.
defaultValuestring | number | readonly string[] | undefined—Initial value for a control supporting uncontrolled state. Inherited DOM typing alone does not give a layout wrapper input behavior.
autoFocusboolean | undefined—Request automatic focus when the element mounts or the primitive opens, according to its source behavior. Choose initial focus deliberately in context.
idstring | undefined—Stable DOM identifier used by labels, descriptions or other explicit associations.
roleReact.AriaRole | undefined—Semantic role appropriate to the rendered element. Preserve required relationships and keyboard behavior.
onFocusReact.FocusEventHandler<HTMLDivElement> | undefined—Receive the native focus event. Preserve the component's existing keyboard and focus behavior.
onBlurReact.FocusEventHandler<HTMLDivElement> | undefined—Receive the native blur event when focus leaves this control.
onChangeReact.ChangeEventHandler<HTMLDivElement, Element> | undefined—Receive the native change event; read the actual control value or checked state from its event target.
onKeyDownReact.KeyboardEventHandler<HTMLDivElement> | undefined—Receive keyboard events. Preserve built-in keyboard behavior unless deliberately implementing an accessible alternative.
onClickReact.MouseEventHandler<HTMLDivElement> | undefined—Receive activation events. The consumer owns the action performed and its result.
onSelectReact.ReactEventHandler<HTMLDivElement> | undefined—Handle the selection event defined by this part's source signature. DOM text-selection events differ from menu or command activation callbacks.
asChildboolean | undefined—Merge this part into one child instead of its default element. Preserve that child's semantics, ref support and accessibility attributes.
refReact.Ref<HTMLDivElement> | undefined—Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).

SidebarTrigger

Interactive control that opens or toggles the associated content. Preserve its accessible name and the required root context.

SidebarTrigger props
PropTypeDefaultDescription
inputMode"search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined—Hints at the type of data that might be entered by the user while editing the element or its contents
aria-describedbystring | undefined—Identifies the element (or elements) that describes the object.
aria-invalidboolean | "false" | "true" | "grammar" | "spelling" | undefined—Indicates the entered value does not conform to the format expected by the application.
aria-labelstring | undefined—Defines a string value that labels the current element.
aria-labelledbystring | undefined—Identifies the element (or elements) that labels the current element.
childrenReact.ReactNode—Represents all of the things React can render.
intent"primary" | "neutral" | "error" | null | undefined—Semantic purpose: primary action, neutral action, or destructive/error action. Independent of visual emphasis. Defaults to primary.
emphasis"link" | "filled" | "stroke" | "lighter" | "ghost" | null | undefined—Visual weight: filled, stroke, lighter, ghost, or link (text only, underlined on hover). Does not change the action's semantics; use asChild with an anchor when it navigates. Defaults to filled.
size"xs" | "sm" | "md" | "lg" | null | undefined—Control size: xs, sm, md, or lg. Keep labels and icons readable when choosing a size. Defaults to md.
asChildboolean | undefined—Merge styles and behavior into one child element instead of rendering a button. Use a real anchor with href for navigation; native disabled does not disable an anchor. Defaults to false.
iconOnlyboolean | undefined—Square button for a single icon at the selected size. Always provide aria-label (or aria-labelledby) because there is no visible text. Defaults to false.
loadingboolean | undefined—Show a spinner while an operation runs. The button keeps its width and focus, exposes aria-busy and aria-disabled, and ignores activation until loading ends; with asChild the spinner renders inside the child and its onClick and navigation are blocked. Defaults to false.
Inherited props (18)
SidebarTrigger inherited props
PropTypeDefaultDescription
refReact.Ref<HTMLButtonElement> | undefined—Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).
disabledboolean | undefined—Make the supported control unavailable through its native or primitive disabled semantics. This does not disable arbitrary child links.
formstring | undefined—ID of the form associated with this control, including when it is rendered outside that form element.
namestring | undefined—Name used by the control's form submission or primitive form integration.
type"button" | "submit" | "reset" | undefined—Native element or primitive mode defined by the source union. Choose a supported value; its meaning depends on the component.
valuestring | number | readonly string[] | undefined—Current value in the shape defined by the source type. For controlled interactive inputs, apply updates from the change callback.
defaultCheckedboolean | undefined—Initial checked state for a control supporting uncontrolled selection. Inherited DOM typing does not give a layout wrapper checkbox behavior.
defaultValuestring | number | readonly string[] | undefined—Initial value for a control supporting uncontrolled state. Inherited DOM typing alone does not give a layout wrapper input behavior.
autoFocusboolean | undefined—Request automatic focus when the element mounts or the primitive opens, according to its source behavior. Choose initial focus deliberately in context.
classNamestring | undefined—Additional classes for this part. Preserve contrast, visible focus and responsive content when adapting styles.
idstring | undefined—Stable DOM identifier used by labels, descriptions or other explicit associations.
roleReact.AriaRole | undefined—Semantic role appropriate to the rendered element. Preserve required relationships and keyboard behavior.
onFocusReact.FocusEventHandler<HTMLButtonElement> | undefined—Receive the native focus event. Preserve the component's existing keyboard and focus behavior.
onBlurReact.FocusEventHandler<HTMLButtonElement> | undefined—Receive the native blur event when focus leaves this control.
onChangeReact.ChangeEventHandler<HTMLButtonElement, Element> | undefined—Receive the native change event; read the actual control value or checked state from its event target.
onKeyDownReact.KeyboardEventHandler<HTMLButtonElement> | undefined—Receive keyboard events. Preserve built-in keyboard behavior unless deliberately implementing an accessible alternative.
onClickReact.MouseEventHandler<HTMLButtonElement> | undefined—Receive activation events. The consumer owns the action performed and its result.
onSelectReact.ReactEventHandler<HTMLButtonElement> | undefined—Handle the selection event defined by this part's source signature. DOM text-selection events differ from menu or command activation callbacks.

Accessibility & usage

From registry/ui/sidebar.meta.json (authored guidance; human review may still be pending). Behavior is checked by Storybook tests, not certified here.

When to use

  • Applications with several top-level areas people move between all day, where keeping navigation visible beats hiding it behind a menu.
  • Navigation that needs groups, nesting, counts or per-item actions (projects, folders, saved views).
  • Shells that must give space back to content: collapse to an icon rail or off canvas on desktop, and open as a sheet on mobile.
  • Listen to changes with onOpenChange while the provider keeps its own state, or control open from the parent when the state is persisted.

When not to use

  • A marketing or documentation site header with a handful of sections; a navigation menu or plain links read better.
  • A short, modal editing task that slides in from the edge; that is a sheet.
  • Switching panels within a single page; that is tabs.
  • As an authorization or routing system: hiding an item does not protect its route.

Anatomy

SidebarProvider
Owns desktop open state (defaultOpen, open, onOpenChange), the separate mobile openMobile state, the Cmd/Ctrl+B shortcut and the --sidebar-width / --sidebar-width-icon variables. Lays out the shell with flexbox, so it also works inside a card or frame.
Sidebar
The panel. side (left/right), variant (sidebar/floating/inset), collapsible (offcanvas/icon/none), mobileTitle and mobileDescription for the mobile sheet's hidden title and description.
SidebarTrigger
Icon button that toggles the panel (desktop) or opens the sheet (mobile); default aria-label 'Toggle sidebar', overridable.
SidebarRail
Optional wide pointer target along the panel edge that toggles it; removed from Tab order so it does not duplicate the trigger.
SidebarInset
The main content area (a main element; asChild to use another element). Pairs with variant='inset'.
SidebarHeader / SidebarContent / SidebarFooter
Top, scrollable middle and bottom regions of the panel.
SidebarGroup, SidebarGroupLabel, SidebarGroupAction, SidebarGroupContent
A titled section with an optional action button (needs an accessible name).
SidebarMenu, SidebarMenuItem, SidebarMenuButton
The list of destinations. SidebarMenuButton takes isActive, size (sm/md/lg), asChild and tooltip (shown only on the collapsed icon rail).
SidebarMenuAction, SidebarMenuBadge
A secondary button at the end of an item (showOnHover reveals it on hover/focus) and a decorative count.
SidebarMenuSub, SidebarMenuSubItem, SidebarMenuSubButton
A nested list of links under an item; SidebarMenuSubButton renders an anchor and takes isActive and size (sm/md).
SidebarInput, SidebarSeparator, SidebarMenuSkeleton
A compact filter field, a divider, and a loading placeholder row (showIcon).
useSidebar
Hook exposing state, open/setOpen, openMobile/setOpenMobile, isMobile and toggleSidebar inside the provider.

Keyboard & interaction

  • SidebarTrigger and Cmd/Ctrl+B toggle the sidebar. The shortcut is ignored while typing in an input, textarea, select or contenteditable, and when another handler already prevented the event.
  • Desktop (768 CSS px and wider): collapsing with collapsible='offcanvas' moves the panel out and makes it inert, so hidden links are skipped by Tab; 'icon' keeps a rail of focusable icon buttons; 'none' never collapses.
  • Mobile (below 768 CSS px): the panel renders inside a modal Sheet named by mobileTitle and described by mobileDescription. Focus moves into it and stays there, Escape or a tap on the overlay closes it, and focus returns to the opener captured by toggleSidebar.
  • Desktop open and mobile openMobile are separate states: collapsing on desktop says nothing about whether the mobile sheet is open.
  • Menu items are ordinary buttons or links in Tab order; there is no arrow-key roving focus. The current destination should carry aria-current='page'.
  • Controlled providers must apply the value from onOpenChange to open; an uncontrolled provider keeps working when you only listen.

Responsive behavior

  • Below 768 CSS px the sidebar is a modal sheet (WAI-ARIA dialog), not a squeezed column; keep SidebarTrigger visible in the content header at every width.
  • The mobile sheet uses the provider's --sidebar-width; set it on the provider's style so both layouts agree, and keep it narrow enough to leave a visible overlay at 320 CSS px.
  • The mobile sheet has no built-in close button: Escape and the overlay dismiss it. On touch-first products add a visible close or 'Done' action inside the panel that calls setOpenMobile(false).
  • The icon rail is a desktop pattern; menu buttons stay at least 32 px tall at size md, above the 24x24 CSS px minimum (WCAG 2.5.8).
  • Width changes animate and stop under prefers-reduced-motion.
  • Menu buttons clip text that does not fit; wrap long labels in a span with truncation so the cut is visible, and keep the full label as the accessible name.

Content guidelines

  • Group labels are short nouns ('Workspace', 'Projects'); item labels name the destination, not an action ('Invoices', not 'View invoices').
  • Keep the top level to the areas people use most; move rarely used destinations into a group or a 'More' item rather than a long scroll.
  • Name every icon-only control: SidebarGroupAction ('Create project'), SidebarMenuAction ('Archive Website redesign') and the trigger.
  • Counts in SidebarMenuBadge are visual; include them in the item's accessible name ('Inbox, 12 unread') when they matter.
  • Translate mobileTitle, mobileDescription and the trigger/rail aria-label with the rest of the interface.

Alternatives

  • Navigation menu — Compact top-level site navigation with optional panels on wide screens.
  • Sheet — A modal edge panel for a task, not persistent navigation.
  • Tabs — Peer panels of one view, switched in place.
  • Breadcrumb — Showing where the current page sits in a deep hierarchy, alongside the sidebar.

Resources