ValyroUI Русская версия

Sidebar

Side navigation panel. Free, MIT · Navigation and layout › Structure

Installation

npx valyro-cli@latest add sidebar
npx shadcn@latest add https://valyro.xyz/r/sidebar.json
npm install valyro-ui

import 'valyro-ui/styles.css';
import { Sidebar } from 'valyro-ui';

Props

PropTypeDefault
sectionsSidebarSection[]Groups of nav items, each with an optional heading (a divider in collapsed mode). Or compose them as children: Sidebar.Section with Sidebar.Items (nested Items make a collapsible group).
childrenReactNodeThe compound form instead of sections: Sidebar.Section elements.
valuestringId of the active item.
defaultValuestringInitial value when uncontrolled.
onValueChange(id: string) => voidCalled with the new value when it changes.
collapsedbooleanfalseIcons-only rail; labels move into tooltips and groups into flyout menus.
headerReactNodeFixed slot above the navigation, e.g. a logo or workspace switcher.
footerReactNodeFixed slot below the navigation, e.g. the user menu.
labelstring'Sidebar'Accessible name of the navigation.

Compound parts

Sidebar.Section (SidebarSectionPart), Sidebar.Item (SidebarItemPart)

Related components

Previous: Navbar · Next: Resizable Panels · All Navigation and layout