Primitives

Tree view

Sites → levels → bays. Select one, or check many with tri-state parents. Full keyboard support.

selectable · ↑ ↓ → ← Home End Enter

  • Gulshan ParkingOpen
    • Level 1
      • Bay A · 40 cars
      • Bay B · 32 cars
      • Bay A · 48 cars
      • Gate 1 (in)
      • Gate 2 (out)
    • Basement 1
    • Basement 2Closed
  • Dhanmondi Lot

Selected: g-l1-a

checkable · parents tick when all children do

  • Gulshan ParkingOpen
    • Level 1
      • Bay A · 40 cars
      • Bay B · 32 cars
    • Level 2
      • Bay A · 48 cars
      • Gate 1 (in)
      • Gate 2 (out)
    • Basement 1
    • Basement 2Closed
  • Dhanmondi Lot

2 bays chosen

Import#

Everything comes from the package root. The example above uses:

your-component.tsx
import { Badge, TreeView, type TreeNode } from "@waveinno/ui";

Props#

Read from the source of this version, so they match the code exactly.

<TreeView>

src/components/ui/tree-view.tsx
PropTypeDefaultDescription
datarequiredTreeNode[]—
expandedstring[]—
defaultExpandedstring[][]
onExpandedChange(ids: string[]) => void—
selectedstring | null—
defaultSelectedstring | nullnull
onSelectedChange(id: string) => void—
checkableboolean—Checkboxes with tri-state parents. The value holds leaf ids.
checkedstring[]—
defaultCheckedstring[][]
onCheckedChange(leafIds: string[]) => void—
guidesbooleantrueLines from each branch to its children.
aria-labelstring"Tree"
classNamestring—

<Badge>

src/components/ui/badge.tsx
PropTypeDefaultDescription
dotbooleantrue
variant"soft" | "solid" | "outline" | "dot" | "gradient" | "live""soft"

Also takes HTMLAttributes<HTMLSpanElement> & VariantProps<typeof badgeVariants>.

Install#

If the project does not have the package yet, add it, then follow the setup for Next.js or Vite once.

$ npm install @waveinno/ui