Sidebar
Sidebar provides application-shell navigation that collapses to an icon rail
on desktop and a drawer on narrow viewports. Use a page-local menu or native
nav when the navigation does not belong to the application shell.
Below 1280px the desktop sidebar collapses to its icon rail, including on mount;
widening restores the state from before that collapse. A manual toggle in that
range is kept, including after widening. A controlled sidebar receives these
automatic changes through onOpenChange and must apply them.
Code
import { AppHeader, AppHeaderContent, AppHeaderLeading, AppLayout, AppLayoutContent, AppLayoutMain, LayoutDashboardIcon, PackageIcon, PageContent, PageHeader, PageHeaderTitle, Sidebar, SidebarBrand, SidebarContent, SidebarMenu, SidebarMenuButton, SidebarMenuItem, SidebarProvider, SidebarTrigger, SproutIcon,} from "@falcon/ui-kit";
export function Example() { return ( <SidebarProvider> <AppLayout> <Sidebar> <SidebarBrand logo={<SproutIcon />} name="Farm operations" />
<SidebarContent aria-label="Primary navigation"> <SidebarMenu> <SidebarMenuItem> <SidebarMenuButton icon={<LayoutDashboardIcon size={16} />} render={<a href="/components/app-layout" />} tooltip="Dashboard" > Dashboard </SidebarMenuButton> </SidebarMenuItem>
<SidebarMenuItem> <SidebarMenuButton icon={<PackageIcon size={16} />} isActive render={<a aria-current="page" href="/components/sidebar" />} tooltip="Orders" > Orders </SidebarMenuButton> </SidebarMenuItem> </SidebarMenu> </SidebarContent> </Sidebar>
<AppLayoutContent> <AppHeader> <AppHeaderLeading> <SidebarTrigger /> </AppHeaderLeading> <AppHeaderContent>Orders</AppHeaderContent> </AppHeader>
<AppLayoutMain> <PageHeader> <PageHeaderTitle>Open orders</PageHeaderTitle> </PageHeader>
<PageContent> <p className="tw:text-sm tw:text-muted-foreground"> Open orders for every location go here. </p> </PageContent> </AppLayoutMain> </AppLayoutContent> </AppLayout> </SidebarProvider> );}Custom header
Section titled “Custom header”SidebarHeader replaces SidebarBrand when the top of the panel needs custom
content.
Code
import { AppHeader, AppHeaderLeading, AppLayout, AppLayoutContent, AppLayoutMain, PackageIcon, Sidebar, SidebarContent, SidebarHeader, SidebarMenu, SidebarMenuButton, SidebarMenuItem, SidebarProvider, SidebarTrigger, SproutIcon,} from "@falcon/ui-kit";
export function Example() { return ( <SidebarProvider> <AppLayout> <Sidebar> <SidebarHeader> <SproutIcon size={20} /> <span className="tw:truncate tw:text-sm tw:font-semibold"> Prairie Grain Co-op </span> </SidebarHeader>
<SidebarContent aria-label="Primary navigation"> <SidebarMenu> <SidebarMenuItem> <SidebarMenuButton icon={<PackageIcon size={16} />} isActive render={<a aria-current="page" href="/components/sidebar" />} tooltip="Orders" > Orders </SidebarMenuButton> </SidebarMenuItem> </SidebarMenu> </SidebarContent> </Sidebar>
<AppLayoutContent> <AppHeader> <AppHeaderLeading> <SidebarTrigger /> </AppHeaderLeading> </AppHeader>
<AppLayoutMain> <div className="tw:flex tw:flex-1 tw:items-center tw:justify-center tw:p-5 tw:text-sm tw:text-muted-foreground"> Open orders for every location go here. </div> </AppLayoutMain> </AppLayoutContent> </AppLayout> </SidebarProvider> );}Composition
Section titled “Composition”SidebarProvider└── AppLayout ├── Sidebar │ ├── SidebarBrand or SidebarHeader │ ├── SidebarContent │ │ ├── SidebarActionButton │ │ ├── SidebarMenu │ │ │ └── SidebarMenuItem │ │ │ ├── SidebarMenuButton │ │ │ ├── SidebarMenuAction │ │ │ ├── SidebarMenuBadge │ │ │ └── SidebarMenuSub │ │ │ └── SidebarMenuSubItem │ │ │ ├── SidebarMenuSubIndicator │ │ │ └── SidebarMenuSubButton │ │ └── SidebarGroup │ │ ├── SidebarGroupLabel │ │ ├── SidebarGroupAction │ │ └── SidebarGroupContent │ │ └── SidebarMenu │ └── SidebarFooter │ ├── SidebarSeparator │ └── SidebarUser └── AppLayoutContent └── AppHeader └── SidebarTriggerWrap the complete AppLayout, including every SidebarTrigger,
in SidebarProvider. See Layout for the complete shell, grouped
and nested navigation, and collapsed navigation compositions.
Collapsed navigation flyouts
Section titled “Collapsed navigation flyouts”Use a SidebarMenuButton flyout when a parent navigation item must expose its
destinations from the collapsed desktop icon rail. This configuration-object API
exists because the expanded nested menu is not rendered in that state; it is a
Sidebar-specific exception, not a general alternative to Falcon’s JSX compound
components.
Sidebar
Section titled “Sidebar”Provides application-shell navigation as a desktop panel or mobile drawer.
Renders a <div> element on desktop and accepts standard <div> props.
SidebarActionButton
Section titled “SidebarActionButton”Renders a primary Sidebar action as a <button> element, with optional
tooltip content for its collapsed state.
children
Section titled “children”children?: React.ReactNodeAction label.
className
Section titled “className”className?: stringCSS class applied to the action button.
icon: React.ReactNodeIcon shown in the action button.
onClick
Section titled “onClick”onClick?: React.MouseEventHandler<HTMLButtonElement>Event handler called when the action button is clicked.
tooltip
Section titled “tooltip”tooltip?: stringSupplemental tooltip text for the collapsed desktop state.
SidebarBrand
Section titled “SidebarBrand”Renders a Sidebar header containing a brand logo and optional name.
logo: React.ReactNodeBrand mark shown in the Sidebar header.
name?: React.ReactNodeCompany or application name.
SidebarContent
Section titled “SidebarContent”Contains the Sidebar’s primary navigation. Renders a <nav> element and
accepts standard <nav> props.
SidebarFooter
Section titled “SidebarFooter”Contains account or secondary controls at the bottom of a Sidebar. Renders a
<div> element and accepts standard <div> props.
SidebarGroup
Section titled “SidebarGroup”Groups related Sidebar navigation items. Renders a <div> element and
accepts standard <div> props.
SidebarGroupAction
Section titled “SidebarGroupAction”Renders an action in a SidebarGroup label row as a <button> element and
accepts standard <button> props. Renders nothing in the collapsed desktop
sidebar.
SidebarGroupContent
Section titled “SidebarGroupContent”Contains SidebarGroup navigation items. Renders a <div> element and accepts
standard <div> props.
SidebarGroupLabel
Section titled “SidebarGroupLabel”Labels a SidebarGroup. Renders a <div> element and accepts standard <div>
props.
SidebarHeader
Section titled “SidebarHeader”Contains branding or controls at the top of a Sidebar. Renders a <div>
element and accepts standard <div> props.
SidebarMenu
Section titled “SidebarMenu”Contains Sidebar menu items. Renders a <ul> element and accepts standard
<ul> props.
SidebarMenuAction
Section titled “SidebarMenuAction”Renders an action on a SidebarMenuItem as a <button> element and accepts
standard <button> props. Renders nothing in the collapsed desktop sidebar.
showOnHover
Section titled “showOnHover”showOnHover?: booleanWhether the action is visible only while its menu item is hovered.
SidebarMenuBadge
Section titled “SidebarMenuBadge”Renders a count or status badge on a SidebarMenuItem. Renders a <div>
element and accepts standard <div> props. Renders nothing in the collapsed
desktop sidebar.
SidebarMenuButton
Section titled “SidebarMenuButton”Renders a Sidebar navigation item as a <button> element by default,
optionally with a collapsed-desktop flyout. Use render for navigation
links.
children
Section titled “children”children?: React.ReactNodeMenu item label.
className
Section titled “className”className?: stringCSS class applied to the menu button.
expanded
Section titled “expanded”expanded?: booleanWhen provided, renders a chevron indicator on the right. Manage state
externally via onClick. In the mobile drawer sections are always
expanded, so the button stops toggling and hides the chevron.
flyout
Section titled “flyout”flyout?: SidebarMenuButtonFlyoutItem[]Sidebar-specific collapsed-desktop flyout configuration objects. Clicking the button toggles the flyout; it is ignored in expanded mode.
icon?: React.ReactNodeIcon shown before the menu button label.
isActive
Section titled “isActive”isActive?: booleanWhether the menu button represents the current location or contains it.
When rendering a link, also set aria-current on the element passed to
render. A button with expanded set is not marked active while its
sub-menu is visible.
onClick
Section titled “onClick”onClick?: React.MouseEventHandler<HTMLButtonElement>Event handler called when the menu button is clicked, except when a collapsed flyout handles the click or a mobile parent section is expanded.
render
Section titled “render”render?: React.ReactElement<any, string | React.JSXElementConstructor<any>>Render the button as this element (e.g. an <a> for navigation) instead of
a native button; the label stays in children.
tooltip
Section titled “tooltip”tooltip?: stringSupplemental text shown in the collapsed-desktop tooltip. This does not set the rendered element’s accessible name.
SidebarMenuItem
Section titled “SidebarMenuItem”Wraps a Sidebar menu item and its related controls. Renders an <li> element
and accepts standard <li> props.
SidebarMenuSub
Section titled “SidebarMenuSub”Contains a nested Sidebar menu. Renders a <div> element and accepts
standard <div> props when visible.
expanded
Section titled “expanded”expanded?: booleanDesktop visibility, driven by the parent button’s expanded state. The mobile drawer ignores it and always shows the sub-menu.
SidebarMenuSubButton
Section titled “SidebarMenuSubButton”Renders a nested Sidebar navigation item as a <button> element by default.
Use render for navigation links.
children
Section titled “children”children?: React.ReactNodeNested menu item label.
className
Section titled “className”className?: stringCSS class applied to the nested menu button.
isActive
Section titled “isActive”isActive?: booleanWhether the nested menu button represents the current location. When
rendering a link, also set aria-current on the element passed to
render.
onClick
Section titled “onClick”onClick?: React.MouseEventHandler<HTMLButtonElement>Event handler called when the nested menu button is clicked.
render
Section titled “render”render?: React.ReactElement<any, string | React.JSXElementConstructor<any>>Render the button as this element (e.g. an <a> for navigation) instead of
a native button; the label stays in children.
SidebarMenuSubIndicator
Section titled “SidebarMenuSubIndicator”Renders the connector for a nested Sidebar menu item as a <div> element. It
accepts no props.
SidebarMenuSubItem
Section titled “SidebarMenuSubItem”Wraps a nested Sidebar menu item. Renders a <div> element and accepts
standard <div> props.
SidebarProvider
Section titled “SidebarProvider”Provides shared responsive state for a Sidebar and its triggers. Renders a
<div> element and accepts standard <div> props.
defaultOpen
Section titled “defaultOpen”defaultOpen?: boolean = trueInitial desktop expanded state for uncontrolled sidebars at viewports
1280px and wider; narrower viewports start collapsed and restore this state
when widened. Defaults to true.
onOpenChange
Section titled “onOpenChange”onOpenChange?: ((open: boolean) => void)Controlled desktop state change handler. Also called when the viewport
narrows below 1280px (with false) and when it widens back (with the state
from before that collapse).
open?: booleanControlled desktop expanded state.
SidebarSeparator
Section titled “SidebarSeparator”Separates Sidebar content regions. Renders a <div> element and accepts
standard <div> props.
SidebarTrigger
Section titled “SidebarTrigger”Opens the mobile drawer or collapsed desktop sidebar. Renders a <button>
element and accepts className and onClick from standard <button>
props.
SidebarUser
Section titled “SidebarUser”Renders a Sidebar account control in a <div> element with a button that
opens its menu content.
menuContent
Section titled “menuContent”menuContent?: React.ReactNodeContent shown when the account control is opened.
name?: stringFull name used to render the user row and auto-generate 2-letter initials.
useSidebar
Section titled “useSidebar”Accesses responsive Sidebar state and controls. Throws when used outside a
SidebarProvider.