Skip to content
MoonUIMoonUI
ComponentsTemplatesPricing
Sign inGet started

Getting started

  • Introduction
  • Installation
  • CDN
  • Authentication
  • shadcn CLI
  • MCP Server
  • Usage

Components

Foundation25 components
  • Alert
  • Aspect Ratio
  • Avatar
  • Badge
  • Button
  • Button Group
  • Checkbox
  • File Upload
  • Input
  • Kbd
  • Label
  • Radio Group
  • Rating
  • Select
  • Slider
  • Switch
  • Textarea
  • Toggle
  • Toggle Group
  • Separator
  • Tags Input
  • Color Picker
  • Date Picker
  • Simple Editor
  • Input OTP
Layout10 components
  • Accordion
  • Breadcrumb
  • Card
  • Carousel
  • Collapsible
  • ResizablePro
  • Scroll Area
  • StepperPro
  • Table
  • Tabs
Navigation & Overlays11 components
  • Alert DialogPro
  • Command
  • Context MenuPro
  • Dialog
  • Dropdown Menu
  • Hover CardPro
  • MenubarPro
  • Pagination
  • Popover
  • SheetPro
  • Tooltip
Feedback4 components
  • Progress
  • Skeleton
  • Spinner
  • Toast
Data & Analytics4 components
  • Data TablePro
  • Advanced ChartPro
  • DashboardPro
  • WidgetsPro
Navigation4 components
  • Command AI+Pro
  • SidebarPro
  • NavbarPro
  • Navigation MenuPro
AI Chat4 components
  • MessagePro
  • Message ScrollerPro
  • AttachmentPro
  • Conversation MarkerPro
Content Management6 components
  • Advanced FormsPro
  • Form WizardPro
  • Quiz FormPro
  • Credit Card InputPro
  • Phone Number InputPro
  • Rich Text EditorPro
Project Management3 components
  • KanbanPro
  • TimelinePro
  • CalendarPro
Performance & Utility8 components
  • Virtual ListPro
  • Memory Efficient DataPro
  • Lazy ComponentPro
  • Optimized ImagePro
  • Performance MonitorPro
  • Performance DebuggerPro
  • Error BoundaryPro
  • Health CheckPro
Interactive & Animation15 components
  • Animated NumberPro
  • Floating DockPro
  • Text RevealPro
  • Image ComparePro
  • Splash CursorPro
  • GitHub StarsPro
  • Animated ButtonPro
  • Magnetic ButtonPro
  • Magnetic ElementsPro
  • Mouse TrailPro
  • Hover Card 3DPro
  • Spotlight CardPro
  • Floating Action ButtonPro
  • LightboxPro
  • Media GalleryPro
Gesture & Touch7 components
  • Swipeable CardPro
  • Draggable ListPro
  • Pinch ZoomPro
  • Swipe ActionsPro
  • Gesture DrawerPro
  • Click AnimationsPro
  • Touch GesturesPro
Text Animations12 components
  • Text HighlighterPro
  • Typewriter TextPro
  • Scrambled TextPro
  • Word RotatePro
  • Morphing TextPro
  • Flip TextPro
  • Number TickerPro
  • Glitch TextPro
  • Shiny TextPro
  • Wavy TextPro
  • Gradient TextPro
  • Text 3DPro
Animations12 components
  • Animated ListPro
  • Bounce EffectPro
  • Blur FadePro
  • Elastic AnimationPro
  • MarqueePro
  • Parallax ScrollPro
  • Reveal CardsPro
  • Scroll RevealPro
  • Fade TransitionsPro
  • Focus TransitionsPro
  • Path AnimationsPro
  • SVG AnimationsPro
Layouts1 components
  • Bento GridPro
Effects9 components
  • ConfettiPro
  • Cursor TrailPro
  • Glow EffectPro
  • Pixel ImagePro
  • Neon EffectPro
  • ShimmerPro
  • RipplePro
  • SparklesPro
  • SpotlightPro
Backgrounds17 components
  • Grid PatternPro
  • MeteorsPro
  • Aurora BackgroundPro
  • ParticlesPro
  • StarfieldPro
  • Dot PatternPro
  • Grid DistortionPro
  • WavesPro
  • Matrix RainPro
  • Liquid BackgroundPro
  • Mesh GradientPro
  • Glitch BackgroundPro
  • Gradient FlowPro
  • Floating ElementsPro
  • Bubble BackgroundPro
  • Geometric PatternsPro
  • Code SnippetsPro
Special UI1 components
  • Glow CardPro
Showcase8 components
  • iPhone MockPro
  • Android MockPro
  • Safari MockPro
  • GlobePro
  • Dotted MapPro
  • Icon CloudPro
  • Tweet CardPro
  • File TreePro

Advanced

  • Theming
  • Customization
  • CLI
  • Help & Support
  1. Docs
  2. Components
  3. File Tree

File Tree

Pro

Render recursive folder/file hierarchies for project structures, file explorers, or repository views with expand/collapse, guide lines, custom icons, and full keyboard-accessible WAI-ARIA tree semantics.

Pro features

What the Pro version adds to this component.

  • Recursive Hierarchy

    Render arbitrarily deep folder/file structures from a single data array.

  • Flexible Expansion

    Start collapsed, fully expanded, or open specific folders by id via defaultExpanded.

  • Guide Lines

    Optional left indentation lines that make nested relationships easy to scan.

  • Selection Callback

    onNodeSelect reports the activated node so you can build interactive explorers.

  • Custom Icons

    Override the default folder/file icons per node to signal file types.

  • Full Arrow-Key Navigation

    Arrow keys walk the visible rows, open and close folders, and step in and out; Home/End jump to the ends.

  • WAI-ARIA Tree

    role=tree/treeitem/group with aria-expanded, aria-selected, aria-level/posinset/setsize and roving tabindex.

Installation

Install via CLI

npx @moontra/moonui-cli add file-tree

Usage

Pro required

Examples

Project Tree

Pro

A realistic Next.js project structure. Pass an array of ids to defaultExpanded to open specific folders on mount while leaving the rest collapsed.

Pro required

Fully Expanded

Pro

Set defaultExpanded to true to open every folder in the tree at once — ideal for showing a complete file map.

Pro required

Without Guide Lines

Pro

Disable the left indentation guide lines with showLines={false} for a cleaner, minimal look.

Pro required

Custom Icons & Selection

Pro

Override the default folder/file icons per node with the icon prop, and react to clicks with onNodeSelect to build interactive explorers.

Pro required

Controlled Expansion

Pro

Provide expandedIds to make the parent the single source of truth for which folders are open. Here two real MoonUI buttons expand or collapse everything at once, in-tree clicks flow back through onExpandedChange, and onNodeToggle reports the most recently toggled node. Give every node a stable id — controlled mode keys off node.id.

Pro required

Keyboard Navigation & Controlled Selection

Pro

The tree implements the full WAI-ARIA tree keyboard contract: the whole tree is a single tab stop (roving tabindex), then Arrow Up/Down walk the visible rows, Arrow Right opens a folder or steps into it, Arrow Left closes it or steps out to the parent, and Home/End jump to the first/last visible row. Pass selectedId to keep the highlighted row owned by your own state.

Pro required

Compact Size

Pro

Switch to size="sm" for dense listings — sidebars, file pickers, or anywhere the tree shares space with other panels.

Pro required

Raw Right-Click Callback

Pro

Skip the built-in menu entirely: onNodeContextMenu hands you the node and the raw MouseEvent so you can position your own menu, open a drawer, or fire an analytics event. It fires independently of renderNodeMenu.

Pro required

Right-Click Context Menu

Pro

Opt in with renderNodeMenu to wrap each node in a real ContextMenu — right-click a file or folder for Rename / New File / Delete actions. Left-click still toggles and selects; you own the menu items (import ContextMenuItem from @moontra/moonui-pro).

Pro required
Previous
Tweet Card
Pro
MoonUIMoonUI

168 React components. 45 free under MIT, 123 Pro.

Unsubscribe anytime.

Product

  • Components
  • Templates
  • Pricing

Resources

  • Documentation
  • GitHub
  • Support

Legal

  • Privacy
  • Terms
  • Refund Policy
Made by Moontra Software
  • X
  • LinkedIn
  • GitHub
  • YouTube