Components

Navigation

Sidebar navigation based on React Router NavLink

Overview

Navigation is a sidebar navigation compound component. Based on React Router's NavLink, it automatically tracks the active state based on URL.

  • Compound — Container, List, Item
  • Auto active — Automatic active state detection based on URL
  • Match strategy — exact, startsWith, endsWith matching
  • Render prop — Access { isActive, isPending } in Item's children, className, style

Basic Usage

Render Prop Pattern

States

StateWhenLook
Default—Default background
HoverPointer over the itemHover background
SelectedCurrent page (aria-current="page")Secondary background
Disableddisabled (aria-disabled="true")Disabled background, text and icon colors
FocusedKeyboard focus2px focus ring inside the item

Links have no native disabled attribute, so a disabled item keeps its link but is marked with aria-disabled="true" and does not navigate or call onClick.

The Basic Usage example above includes a disabled item (Reports).

Match Strategy

match="exact"

match="startsWith"

Sub-components

PropTypeDefaultRequiredDescription
childrenReactNode-YesUsually List. Fixed to the left edge, 256px wide
classNamestring-NoExtra CSS class

Fixed sidebar: position: fixed, width: 256px, padding: 600.

PropTypeDefaultRequiredDescription
childrenReactNode-YesItems
match'exact' | 'startsWith' | 'endsWith''exact'NoHow every item in the list finds the current page
classNamestring-NoExtra CSS class

Wrapped with <nav aria-label="Main navigation">.

PropTypeDefaultRequiredDescription
tostring-YesDestination path. Also used to find the current page
iconNameIconName-NoIcon before the text (when children is not a function)
disabledbooleanfalseNoDisabled. Adds aria-disabled="true" and blocks navigation
match'exact' | 'startsWith' | 'endsWith'-NoHow to compare paths to find the current page. Falls back to the List match, then exact
onClickMouseEventHandler<HTMLAnchorElement>-NoClick handler. Not called when disabled
childrenReactNode | ((props: ItemRenderProps) => ReactNode)-YesText or a render function
aria-labelstring-NoAccessible name

Render Prop Type

export type ItemRenderProps = {
  isActive: boolean
  isPending: boolean
}

Specification

base

상태요소속성값
enabledrootpadding$size.space.300
enabledrootgap$size.space.300
enabledrootborderRadius$size.radius.200
enabledrootbackgroundColor$color.background.default.default
enabledrootcolor$color.text.default.default
hoverrootbackgroundColor$color.background.default.defaultHover
selectedrootbackgroundColor$color.background.default.secondary
disabledrootbackgroundColor$color.background.disabled.default
disabledrootcolor$color.text.disabled.default
disablediconcolor$color.icon.disabled.default

Guidelines

  • Container uses position: fixed, so apply margin-left: 256px to adjacent content
  • match="startsWith" is suitable for most nested routes
  • Requires React Router dependency — use only in React Router projects