Modus UI

Root Nav

Web (React)

A docs-style navigation tree whose hairline roots draw out to each open chapter.

Chapters open and fold under mono headings, and a hairline root draws from the trunk to each page, with the active page's root inked in the accent colour. Use it as the sidebar of a docs site or any shallow two-level tree.

Modus / Root Nav

Installation

CLI

npx @modus-ui/cli add root-nav

Manual

  1. Copy the code from the component tab.
  2. Create a file at components/ui/root-nav.tsx.
  3. Paste the code.

Usage

tsx
import { RootNav } from "@/components/ui/root-nav";

export default function Example() {
  return <RootNav />;
}

Props

PropTypeDefaultDescription
itemsanyDEFAULT_ITEMS-
defaultOpennumber0-
defaultActivestring""-
onSelectany--
onToggleany--
colorstring"hsl(var(--foreground))"-
accentColorstring"hsl(var(--primary))"-
lineColorstring"hsl(var(--border))"-
widthnumber240-
rowHeightnumber36-
indentnumber36-
trunknumber14-
radiusnumber4-
lineWidthnumber1.5-
fontSizenumber14-
drawDurationnumber400-
foldDurationnumber300-

Comments

  • No comments yet.