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
  e62ea10b_2b2e_b456_05df_fd6d36eb0bf6["Tree()"]
  02e4ddfa_c285_29ce_8c5f_b80d479c7307["app-sidebar.tsx"]
  e62ea10b_2b2e_b456_05df_fd6d36eb0bf6 -->|defined in| 02e4ddfa_c285_29ce_8c5f_b80d479c7307
  style e62ea10b_2b2e_b456_05df_fd6d36eb0bf6 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/v4/registry/bases/radix/blocks/sidebar-11/components/app-sidebar.tsx lines 113–170

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"}
      >
        <CollapsibleTrigger asChild>
          <SidebarMenuButton>
            <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>
        </CollapsibleTrigger>
        <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/radix/blocks/sidebar-11/components/app-sidebar.tsx.
Where is Tree() defined?
Tree() is defined in apps/v4/registry/bases/radix/blocks/sidebar-11/components/app-sidebar.tsx at line 113.

Analyze Your Own Codebase

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

Try Supermodel Free