Skip to main content
Version: Next

Sidebar API

import { Sidebar } from '@editora/ui-react';

Props​

PropTypeDescription
autoSaveboolean
collapseButtonbooleanWith collapsible: a chevron button in the header row that collapses / expands the sidebar.
collapsedbooleanControlled: the sidebar is collapsed while this is true. Update it from onCollapseChange, or the collapse button and responsive collapsing will be undone on your next change of this prop.
collapsedWidthstring
collapsibleboolean
defaultCollapsedbooleanUncontrolled: start collapsed, then let the sidebar (collapse button, rail clicks, small screens) keep its own state. Read changes with onCollapseChange. Ignored when collapsed is set.
density'compact' | 'default' | 'comfortable'
elevation'none' | 'low' | 'high'
headlessboolean
itemFontSizenumber | string
itemGapnumber | stringSpace between an item's icon, label and badge.
itemHeightnumber | string
itemLineHeightnumber | string
itemPaddingXnumber | string
itemPaddingYnumber | string
itemRadiusnumber | string
itemsSidebarItemInput[]
layout'list' | 'dual'dual: the top-level items become an icon rail and the open one's children fill a panel beside it (as in Slack or Supabase). collapsed then hides the panel and keeps the rail; width sizes the panel. Put a logo or avatar on the rail with Sidebar.RailStart / Sidebar.RailEnd.
maxWidthstring
minWidthstring
navigation'native' | 'client'client always keeps the page on link clicks (route from onSelect/onNavigate).
onAreaChange(value: string) => voidlayout="dual": a rail click opened another area (its value). The current page is unchanged.
onChange(detail: SidebarSelectDetail) => void
onCollapseChange(collapsed: boolean) => void
onNavigate(detail: SidebarNavigateDetail) => voidFires before a link item (href) is followed. Call detail.preventDefault() to route in the app instead of a full page load. Clicks that open a new tab are never intercepted.
onSearchChange(query: string) => void
onSelect(detail: SidebarSelectDetail) => void
onToggle(collapsed: boolean) => void
onWidthChange(detail: { width: number; collapsedWidth: number; minWidth: number; maxWidth: number; source: string }) => void
position'left' | 'right'
radiusnumber | string
railboolean
resizableboolean
rowGapnumber | stringSpace between rows (default 8px).
searchQuerystring
sectionLabelTransform'uppercase' | 'none' | 'capitalize'
showBadgesboolean
showIconsboolean
size'sm' | 'md' | 'lg' | '1' | '2' | '3'
storageKeystring
toneSidebarTone
valuestring
variant'surface' | 'soft' | 'floating' | 'contrast' | 'minimal' | 'split' | 'inset' | 'indicator' | 'pill' | 'solid' | 'gradient' | 'glass'Look: inset (with Layout inset), indicator (a brand bar on the current item), pill, solid (the current item filled with the brand colour), gradient (deep brand gradient), glass (frosted, for a photo or gradient behind it), contrast (dark), minimal, split, surface, soft, floating.
widthstring

Also accepts the standard HTML and React props of the element it renders (className, style, id, aria-*, data-*, event handlers).

Sidebar.Header props​

PropTypeDescription
childrenReact.ReactNode

Also accepts the standard HTML and React props of the element it renders (className, style, id, aria-*, data-*, event handlers).

Sidebar.Search props​

PropTypeDescription
childrenReact.ReactNode

Also accepts the standard HTML and React props of the element it renders (className, style, id, aria-*, data-*, event handlers).

Sidebar.SearchInput props​

PropTypeDescription
iconReact.ReactNode

Also accepts the standard HTML and React props of the element it renders (className, style, id, aria-*, data-*, event handlers).

Sidebar.Content props​

PropTypeDescription
childrenReact.ReactNode

Sidebar.Group props​

PropTypeDescription
childrenReact.ReactNode
titlestring

Sidebar.Item props​

PropTypeDescription
activeboolean
badgestring
childrenReact.ReactNode
descriptionstring
disabledboolean
hrefstring
iconReact.ReactNode | string
labelstring
relstring
sectionstring
targetstring
toneSidebarTone
value (required)string

Sidebar.Promo props​

PropTypeDescription
childrenReact.ReactNode

Also accepts the standard HTML and React props of the element it renders (className, style, id, aria-*, data-*, event handlers).

Sidebar.Footer props​

PropTypeDescription
childrenReact.ReactNode

Also accepts the standard HTML and React props of the element it renders (className, style, id, aria-*, data-*, event handlers).

Sidebar.RailStart props​

PropTypeDescription
childrenReact.ReactNode

Also accepts the standard HTML and React props of the element it renders (className, style, id, aria-*, data-*, event handlers).

Sidebar.RailEnd props​

PropTypeDescription
childrenReact.ReactNode

Also accepts the standard HTML and React props of the element it renders (className, style, id, aria-*, data-*, event handlers).

Element: <ui-sidebar>​

Sidebar renders the ui-sidebar custom element from @editora/ui-core, which can also be used without React.

Attributes: auto-save, collapse-button, collapsed, collapsed-width, collapsible, density, elevation, headless, item-font-size, item-gap, item-height, item-line-height, item-padding-x, item-padding-y, item-radius, items, layout, max-width, min-width, position, radius, rail, resizable, row-gap, search-query, section-label-transform, show-badges, show-icons, size, storage-key, tone, value, variant, width

Events: area-change, change, collapse-change, resize, resize-end, resize-start, search-change, select, toggle, width-change