Skip to content
Docs
컴포넌트로 돌아가기

Sidebar

@hua-labs/ui/navigation
v1.0.0

대시보드 레이아웃을 위한 접을 수 있는 사이드바 네비게이션 컴포넌트입니다.

설치

bash
npm install @hua-labs/hua
Import
tsx
import { Sidebar } from "@hua-labs/ui/navigation";

@hua-labs/ui의 UI 컴포넌트를 @hua-labs/hua에서 통합 제공합니다.

UI 컴포넌트, 모션 훅, i18n을 하나의 패키지로 사용할 수 있습니다.

Pro 컴포넌트입니다. Pro 라이선스가 필요합니다.

라이브 데모

기본 사용법

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

Props

이름타입기본값설명
id*string-Section identifier
labelstring-Section label
items*SidebarNavItem[]-Navigation items

SidebarNavItem

Props

이름타입기본값설명
id*string-Section identifier
label*string-Section label
hrefstring-Link URL
iconIconName | React.ReactNode-Item icon
badgeReact.ReactNode-Optional badge
activeboolean-Active state
onClick() => void-클릭 핸들러

코드 예시

기본 사용법

BasicSidebar.tsxtsx
import { Sidebar } from "@hua-labs/ui/navigation";

export function BasicSidebar() {
  return (
    <Sidebar
      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" }
          ]
        }
      ]}
    />
  );
}