navigationsidebar-frame
SidebarFrame
Sidebar and main frame with mobile Sheet support and desktop layout wrappers.
Import#
Slot Structure#
Root frame containing a sidebar with optional header/footer and a scrollable main area.
Examples#
Basic#
Desktop fixed layout with a simple header/body/main composition. Use --sidebar-width to control sidebar width
Variants#
Compare default, floating, and inset visual variants with the same content.
Sides#
Compare side="left" and side="right" desktop layouts.
SheetResizableRender#
Use SidebarFrameSheetResizableRender with external collapse button, collapsibleMin, and icon handle.
ForcedMobile#
Force mobile mode and open the sidebar sheet from main content via ctx.toggle.
Header and Footer Slots#
Use optional sidebarHeaderRender and sidebarFooterRender while keeping body as the scroll region.
API Reference#
Attributes#
Slot
root2 attributesFrame container that coordinates sidebar and main content layout.
Data Attributes
| Data Attribute | Description |
|---|---|
| data-orientation | Stores the rendered orientation. |
| data-resizable-root | State or slot attribute exposed for styling hooks and selectors. |
Props#
| Prop | Type | Default | Description |
|---|---|---|---|
| class | ClassValue | — | Class applied to the component root or trigger element. |
| classes | SidebarFrameT.Classes | undefined | — | — |
| frameRender | ComponentOrElement<SidebarFrameT.FrameRenderProps> | undefined | SidebarFrameSheetOnlyRender | Optional frame renderer used to compose sidebar/main layout. |
| isMobile | boolean | undefined | — | Controlled mobile mode state.
When omitted, mobile state is resolved from `matchMedia`. |
| mainRender* | ComponentOrElement<SidebarFrameT.MainRenderProps> | — | Render function for main content section. |
| ref | JSX.HTMLElementTags["div"] extends { ref?: infer Ref; } ? Ref : never | undefined | — | — |
| scrollThreshold | number | undefined | 60 | Scroll threshold for `scrolled` state. |
| side | "right" | "left" | undefined | — | — |
| sidebarBodyRender* | ComponentOrElement<SidebarFrameT.SidebarBodyRenderProps> | — | Render function for sidebar body section. |
| sidebarFooterRender | ComponentOrElement<SidebarFrameT.SidebarFooterRenderProps> | undefined | — | Optional render function for sidebar footer section. |
| sidebarHeaderRender | ComponentOrElement<SidebarFrameT.SidebarHeaderRenderProps> | undefined | — | Optional render function for sidebar header section. |
| style | JSX.CSSProperties | undefined | — | — |
| styles | SidebarFrameT.Styles | undefined | — | — |
| variant | "default" | "floating" | "inset" | undefined | — | — |