Home / Function/ Tree() — ui Function Reference

Tree() — ui Function Reference

Architecture documentation for the Tree() function in app-sidebar.tsx from the ui codebase.

Entity Profile

Dependency Diagram

graph TD
  12954e86_73e8_d095_dfda_da8fa204763b["Tree()"]
  8d14e83c_60a4_deb4_8879_9977864a903d["app-sidebar.tsx"]
  12954e86_73e8_d095_dfda_da8fa204763b -->|defined in| 8d14e83c_60a4_deb4_8879_9977864a903d
  style 12954e86_73e8_d095_dfda_da8fa204763b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/v4/registry/bases/base/blocks/sidebar-11/components/app-sidebar.tsx lines 110–163

function Tree({ item }: { item: TreeItem }) {
  const [name, ...items] = Array.isArray(item) ? item : [item]
  if (!items.length) {
    return (
      <SidebarMenuButton
        isActive={name === "button.tsx"}
        className="data-[active=true]:bg-transparent"
      >
        <IconPlaceholder
          lucide="FileIcon"
          tabler="IconFile"
          hugeicons="FileIcon"
          phosphor="FileIcon"
          remixicon="RiFileLine"
        />
        {name}
      </SidebarMenuButton>
    )
  }
  return (
    <SidebarMenuItem>
      <Collapsible
        className="group/collapsible [&[data-state=open]>button>svg:first-child]:rotate-90"
        defaultOpen={name === "components" || name === "ui"}
      >
        <SidebarMenuButton render={<CollapsibleTrigger />}>
          <IconPlaceholder
            lucide="ChevronRightIcon"
            tabler="IconChevronRight"
            hugeicons="ArrowRight01Icon"
            phosphor="CaretRightIcon"
            remixicon="RiArrowRightSLine"
            className="transition-transform"
          />
          <IconPlaceholder
            lucide="FolderIcon"
            tabler="IconFolder"
            hugeicons="FolderIcon"
            phosphor="FolderIcon"
            remixicon="RiFolderLine"
          />
          {name}
        </SidebarMenuButton>
        <CollapsibleContent>
          <SidebarMenuSub>
            {items.map((subItem, index) => (
              <Tree key={index} item={subItem} />
            ))}
          </SidebarMenuSub>
        </CollapsibleContent>
      </Collapsible>
    </SidebarMenuItem>
  )
}

Subdomains

Frequently Asked Questions

What does Tree() do?
Tree() is a function in the ui codebase, defined in apps/v4/registry/bases/base/blocks/sidebar-11/components/app-sidebar.tsx.
Where is Tree() defined?
Tree() is defined in apps/v4/registry/bases/base/blocks/sidebar-11/components/app-sidebar.tsx at line 110.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free