Skip to content
Velkin LogoVelkin Logo
Velkin
VELKIN/UI

Modern UI components for product teams and their AI agents. Lit core, typed wrappers, live MCP.

sales@velkinui.com

Product

  • Docs
  • Components
  • Studio
  • Pricing

Resources

  • Quick start
  • Blog
  • Changelog
  • Roadmap
  • Status

Project

  • About
  • Contact
  • License
  • Privacy
  • Terms

© 2026 Velkin. MIT core · Pro licenses available.

VELKIN

Tree

Pro

A tree component for browsing folders and files with virtualization.

vu-tree · @velkin/react-pro/tree

Copy page

Import

React
npm i @velkin/react-pro

import { LicenseInfo } from "@velkin/license";
// Vite: import.meta.env.VITE_VELKIN_LICENSE_KEY
// Next: process.env.NEXT_PUBLIC_VELKIN_LICENSE_KEY
LicenseInfo.setLicenseKey(import.meta.env.VITE_VELKIN_LICENSE_KEY ?? process.env.NEXT_PUBLIC_VELKIN_LICENSE_KEY ?? "");

// @velkin-pro
import { VuTree } from "@velkin/react-pro/tree";

Examples

API

Props

PropTypeDefaultDescription
itemsVuTreeItem[][]Directory data with unique `id` and `label`. Default: `[]`.
valuenull | stringnullCurrently open file id. Default: `null`.
expandedIdsstring[]—Controlled expanded folder ids; omit for uncontrolled `item.expanded`.
filterTextstring""Case-insensitive label filter. Default: `""`.
noResultsLabelstring""Fallback when filter matches no rows; defaults to a localized label.
filterDebounceMsnumber150Delay before applying `filterText` to large trees. Default: `150`.
expandIcon"ion:chevron-down""ion:chevron-down"Iconify name for expanded folders. Default: chevron-down.
collapseIcon"ion:chevron-forward""ion:chevron-forward"Iconify name for collapsed folders. Default: chevron-forward.
sizeVuTreeSize"md"Row density preset. Default: `"md"`.
itemHeightnumber—Virtual row height in px; defaults to the `size` preset (sm 28, md 32, lg 36).
variantVuTreeVariant"explorer"`explorer` borderless sidebar or `panel` card. Default: `"explorer"`.
withIconsbooleantrueAuto file/folder icons when nodes omit `icon`. Default: `true`.
withLinesbooleanfalseShow guide lines between nodes. Default: `false`.
showSizebooleantrueShow trailing file size when nodes include `size`. Default: `true`.
withFolderFirstSortbooleanfalseSort folders before files at each level. Default: `false`.
autoExpandParentbooleantrueExpand ancestors while filtering. Default: `true`.
itemDragVuTreeDragMode"off"Row drag mode: `off`, `reorder`, `reparent`, or `both`. Default: `"off"`.
lazyLoadVuTreeLazyLoadFn—Async children fetch when a folder expands.

Events

EventDetailDescription
vu-activateVuTreeActivateDetailWhen a file row is activated.
vu-expandVuTreeExpandDetailWhen a folder row expands.
vu-collapseVuTreeCollapseDetailWhen a folder row collapses.
vu-contextmenuVuTreeContextMenuDetailWhen a row receives `contextmenu`.
vu-dragstartVuTreeDragStartDetailWhen a row drag starts.
vu-reorderVuTreeReorderDetailWhen a row is reordered among siblings.
vu-moveVuTreeMoveDetailWhen a row is reparented or dropped into a folder.

Slots

SlotDescription
—- Default slot for additional tree content.
no-resultsCustom body when `filterText` matches no rows.

CSS parts

PartDescription
treeThe outer scrolling tree wrapper.
item-wrapperWrapper for each virtualized row.
itemClickable row container for a node.
indentIndent gutter grouping ancestor guide columns.
indent-guideOne ancestor-depth vertical guide column.
switcherChevron column on expandable folder rows; omitted on file rows when `withlines`.
contentLabel column between icon and trailing meta.
item-labelText label of a node.
trailingFixed-width trailing column (badge + file size).
item-sizeFile size text inside the trailing column.
item-badgeGit-style status badge before file size.
item-icon-leftLeading file/folder icon.
expand-buttonExpand/collapse chevron or loading spinner.
no-resultsFilter empty-state region.
no-results-labelDefault no-results text when the slot is empty.
drop-indicatorInsertion line or folder highlight shown during row drag.

Methods

MethodDescription
expandAllExpands all folders.
collapseAllCollapses all folders.
focusNodeFocuses a visible node by flattened index.
scrollToItemScrolls a visible node into view by id.
focusItemByIdMoves roving focus and scrolls a visible node into view.

Types

NameDefinition
string | null
null | string
VuTreeActivateDetail
{ item: VuTreeItem; value: string; }
VuTreeCollapseDetail
{ item: VuTreeItem; value: string; }
VuTreeContextMenuDetail
{
  item: VuTreeItem;
  value: string;
  originalEvent: MouseEvent;
}
VuTreeDragMode
"both" | "off" | "reorder" | "reparent"
VuTreeDragStartDetail
{ item: VuTreeItem; value: string; }
VuTreeExpandDetail
{ item: VuTreeItem; value: string; }
VuTreeLazyLoadFn
(item: VuTreeItem) => Promise<VuTreeItem[]>
VuTreeMoveDetail
{
  item: VuTreeItem;
  value: string;
  fromParentId: string | null;
  toParentId: string | null;
  fromIndex: number;
  toIndex: number;
  position: VuTreeDropPosition;
}
VuTreeReorderDetail
{
  item: VuTreeItem;
  value: string;
  parentId: string | null;
  fromIndex: number;
  toIndex: number;
  position: "before" | "after";
}
VuTreeSize
"sm" | "md" | "lg"
VuTreeVariant
"explorer" | "panel"

Related

Data display

  • AvatarAn avatar component with image, initials, icon, or custom content.
  • Avatar GroupAn avatar group component that stacks overlapping avatars.
  • BadgeA badge component for counts, status dots, and overlay marks.
  • ChipA chip component for tags and filters with dismiss or toggle actions.
  • Data TableA data table component with sorting, filtering, and selection.
  • DividerA divider component for horizontal or vertical layout separation.

Guides

  • Pro licenseLicenseInfo and Pro imports
  • AppearanceShared visual props
  • EventsSelection and change events

Browse

  • Previous: Model ViewerEarlier in the sidebar
  • Next: VideoLater in the sidebar
  • All componentsBrowse the full index