Sidebar
SidebarLayout renders a .sidebar-layout wrapper and enhances a hand-authored .sidebar panel, optional .sidebar-backdrop, and .sidebar-close inside it — four built-in layout behaviors (beside/over/fixed/under-navbar), outside-click/Escape, focus trapping on mobile overlays, and URL-based active-item detection. Compound subcomponents (Sidebar, SidebarHeader, SidebarBody, SidebarSection, SidebarItem, SidebarFooter, SidebarMain) remove the markup boilerplate, but hand-authoring the raw .sidebar-* tree works exactly the same.
Usage
import {
SidebarLayout, Sidebar, SidebarHeader, SidebarBody,
SidebarSection, SidebarItem, SidebarMain, SidebarToggle,
} from '@mav-labs-inc/mavkit-react'
// Uncontrolled, closed by default
<SidebarLayout variant="over" position="end">
<Sidebar>
<SidebarHeader title="Menu" />
<SidebarBody>
<SidebarSection label="Main">
<SidebarItem href="/" active>Home</SidebarItem>
</SidebarSection>
</SidebarBody>
</Sidebar>
<SidebarMain>
<SidebarToggle>Menu</SidebarToggle>
…
</SidebarMain>
</SidebarLayout>
// Controlled, like Modal
<SidebarLayout variant="over" open={isOpen} onOpenChange={setIsOpen}>…</SidebarLayout>Example
variant="over" — click “Menu” to open the panel over the content.
Props
SidebarLayout
Sidebar
Renders the sliding panel + its backdrop as siblings (a Fragment).
SidebarHeader
SidebarSection
SidebarItem
Renders an <a> when href is given (auto-closes an overlay panel on click), otherwise a <button type="button"> for non-navigation actions.
Also accepts every native <a>/<button> attribute (whichever it renders).
SidebarBody / SidebarFooter / SidebarMain
Thin wrappers rendering .sidebar-body / .sidebar-footer / .sidebar-main — accept only className/children.
SidebarToggle
Companion toggle button consuming the enclosing SidebarLayout context (or an explicit controller prop for a toggle rendered outside it).
Also accepts every native <button> attribute.
useSidebar()
Access the enclosing SidebarLayout controller — for building a custom toggle.