Skip to content
WunderUI

useSidebarState

Pro
import { useSidebarState } from "@wunderui/react"

Installation

useSidebarState comes with WunderUI Core and Pro, in the entry of the package from your plan. See the plans. Then import it:

tsx
import { useSidebarState } from "@wunderui/react"

Signature

ts
useSidebarState(options?: SidebarStateOptions): SidebarState

Parameters

ParameterTypeDescription
options.defaultCollapsed optionalboolean | undefined
options.storageKey optionalstring | undefined
options.shortcut optionalstring | undefined

Returns

FieldTypeDescription
collapsedboolean
setCollapsed(next: boolean | ((prev: boolean) => boolean)) => void
toggle() => void
bind(element: HTMLElement | null) => voidRef callback for the root element that contains the sidebar: it listens for the keyboard shortcut.

Notes for AI

Give your coding assistant the page or the MCP call instead of screenshots.

MCPget_component("useSidebarState")
Importimport { useSidebarState } from "@wunderui/react"

The full library index for assistants is at /llms.txt.