Skip to content

    Browse components

    Folder Tree

    File explorer tree with springy expand/collapse, a highlight that glides to the selected row, file-type icons and full keyboard navigation.

    Open
    Customize

    Installation

    npx shadcn@latest add @glint-ui/folder-tree

    First time using @glint-ui? Add the registry to components.json once, or install by URL: npx shadcn@latest add https://glintui.vercel.app/r/folder-tree.json

    Usage

    import { FolderTree } from "@/components/ui/folder-tree";
    
    <FolderTree
      data={[
        { id: "src", name: "src", children: [{ id: "page", name: "page.tsx" }] },
        { id: "readme", name: "README.md" },
      ]}
      defaultExpanded={["src"]}
      onSelect={(node) => open(node.id)}
    />

    Props

    PropTypeDefaultDescription
    dataReactNode—Array of { id, name, children?, icon? }; nodes with children are folders.
    indentnumber16Px of indent per level.
    showLinesbooleantrueDraw nesting guide lines.
    folderColorstring"#7dd3fc"Folder icon tint.
    defaultExpandedstring[]—Folder ids open at first render.
    defaultSelectedstring—Node id selected at first render.
    labelstring—Accessible name for the tree.
    onSelectReactNode—Called with (node, path) when a row is picked.
    classNamestring—Extra classes for the root element.