Skip to content

DashboardSidebar

@hua-labs/ui/advanced/dashboard
v1.0.0

bash
npm install @hua-labs/hua
tsx
import { DashboardSidebar } from "@hua-labs/ui/advanced/dashboard";

Main content area

Sidebar: Expanded

/

Props

sections*SidebarSection[]-Navigation sections
logoReact.ReactNode-Logo component
productSwitcherReact.ReactNode-Product switcher component
footerActionsReact.ReactNode-Footer actions
isCollapsedboolean-Controlled collapsed state
defaultCollapsedbooleanfalseInitial collapsed state
onToggleCollapsed(collapsed: boolean) => void-Collapse toggle callback
collapsedWidthnumber72Collapsed sidebar width
expandedWidthnumber264Expanded sidebar width
mobileBreakpointnumber1024Mobile breakpoint
overlayBackgroundstring-Mobile overlay background color

SidebarSection

id*string-Section identifier
labelstring-Section label
items*SidebarNavItem[]-Navigation items

SidebarNavItem

id*string-Item identifier
label*string-Item label
hrefstring-Link URL
iconIconName | React.ReactNode-Item icon
badgeReact.ReactNode-Optional badge
activeboolean-Active state
onClick() => void-Click handler

BasicSidebar.tsxtsx
import { DashboardSidebar } from "@hua-labs/ui/advanced/dashboard";

export function BasicSidebar() {
  return (
    <DashboardSidebar
      logo={<Logo />}
      sections={[
        {
          id: "main",
          label: "Main",
          items: [
            { id: "dashboard", label: "Dashboard", href: "/dashboard", icon: "layout", active: true },
            { id: "transactions", label: "Transactions", href: "/transactions", icon: "wallet" },
            { id: "analytics", label: "Analytics", href: "/analytics", icon: "barChart" }
          ]
        },
        {
          id: "settings",
          label: "Settings",
          items: [
            { id: "profile", label: "Profile", href: "/profile", icon: "user" },
            { id: "settings", label: "Settings", href: "/settings", icon: "settings" }
          ]
        }
      ]}
    />
  );
}