Saturation UIsaturation UI
DocsComponentsBlocks
⌘K

Getting Started

IntroductionInstallationTheming

Components

AccordionAI Chat InputAlertAnimated GroupAnimated NumberAvatarBadgeBorder TrailBreadcrumbButtonButton GroupCalendarCardChartCheckboxCollapsibleComboboxCommandContext MenuData TableDate PickerDialogDropdown MenuEmptyFieldGlow EffectInputInput GroupItemKbdMenubarNovel EditorPaginationProgressive BlurProgressSelectSheetSkeletonSonnerSpinnerSpotlightSwitchTableTabsText EffectText ShimmerTextareaToggleToggle GroupTreeTypography
Components
/
Tree

Tree

A hierarchical tree view component for displaying nested data structures with expand/collapse functionality.

Estimated
ID
Name
Qty
Unit
Rate
X
Overtime
Working
Committed
Actuals

Installation

npx shadcn@latest add https://ui.saturation.io/r/tree.json

Usage

import {
  TreeProvider,
  TreeView,
  TreeNode,
  TreeNodeTrigger,
  TreeNodeContent,
  TreeExpander,
  TreeIcon,
  TreeLabel,
} from "@/components/ui/tree"

export default function Example() {
  return (
    <TreeProvider>
      <TreeView>
        <TreeNode nodeId="root">
          <TreeNodeTrigger>
            <TreeExpander hasChildren />
            <TreeIcon hasChildren />
            <TreeLabel>Root</TreeLabel>
          </TreeNodeTrigger>
          <TreeNodeContent hasChildren>
            <TreeNode level={1} nodeId="child">
              <TreeNodeTrigger>
                <TreeExpander />
                <TreeIcon />
                <TreeLabel>Child</TreeLabel>
              </TreeNodeTrigger>
            </TreeNode>
          </TreeNodeContent>
        </TreeNode>
      </TreeView>
    </TreeProvider>
  )
}

Examples

Default

A basic tree structure with folders and files.

Projects
Website Redesign
Homepage
About Page
Contact Form
Mobile App
Resources

Column Visibility

Manage column visibility with groups and individual columns. Click the eye icon to toggle visibility.

Estimated
ID
Name
Qty
Unit
Rate
X
Overtime
Working
Committed
Actuals

File System

A tree representing a file system structure.

src
components
button.tsx
input.tsx
card.tsx
lib
app.tsx
public
package.json

Collapsed by Default

All nodes start collapsed.

Documents

API Reference

ComponentPropTypeDescription
TreeProviderdefaultExpandedIdsstring[]IDs of nodes expanded by default
TreeNodenodeIdstringUnique identifier for the node
TreeNodelevelnumberNesting level (0-based)
TreeNodeisLastbooleanWhether this is the last child
TreeExpanderhasChildrenbooleanShow chevron for expandable nodes
TreeIconhasChildrenbooleanShow folder vs file icon
TreeNodeContenthasChildrenbooleanRequired for proper rendering

On This Page

  • Preview
  • Installation
  • Usage
  • Examples
    • Default
    • File System
    • Collapsed by Default
  • API Reference

Deploy your Saturation UI app

Build beautiful, saturated interfaces with our component library.

Deploy to Vercel for the best performance and developer experience.