Blossom UI

Tree

Tree component for files and categories, with the keyboard model of a native tree, controlled state and icons.

How to use it

Run npx @blossomui/react add tree, or copy src/components/UI/Tree/Tree.tsx into your React project and import it.

import { Tree } from './components/ui/Tree'

Props

TreeNode

PropTypeDescription
id (required)string
label (required)string
iconReactNodeElement shown before the label, for example a file or folder icon.
childrenTreeNode[]Child nodes. A node with children can be opened and closed.
disabledboolean

TreeProps

PropTypeDescription
nodes (required)TreeNode[]
selectedstring | nullControlled selected node. Use together with `onSelect`.
defaultSelectedstring | nullNode that starts selected when the tree is not controlled.
onSelect(id: string, node: TreeNode) => void
expandedstring[]Controlled list of open nodes. Use together with `onExpandedChange`.
defaultExpandedstring[]Open nodes when the tree is not controlled.
onExpandedChange(ids: string[]) => void
colorstringAccent color of the selected node: any CSS color. Without it the component uses `--blossom-accent`.
labelstringAccessible name of the tree.
classNamestring

Getting started

  • Introduction
  • Installation
  • Changelog

Customization

  • Colors
  • Brand color
  • Texts and translation

Components

  • Accordion
  • Alert dialog
  • Alerts
  • Avatar
  • Badges
  • Banner
  • Breadcrumb
  • Buttons
  • Calendar
  • Cards
  • Carousel
  • Charts
  • Chip input
  • Collapsible
  • Color picker
  • Combobox
  • Command palette
  • Context menu
  • Copy button
  • Date picker
  • Drawer
  • Dropdown
  • Empty state
  • File upload
  • Footer
  • Forms
  • Hover card
  • Jumbotron
  • KBD
  • Menubar
  • Modal
  • Navbar
  • Navigation menu
  • Number input
  • OTP input
  • Pagination
  • Popover
  • Pricing
  • Progress
  • Rating
  • Resizable panels
  • Scroll area
  • Segmented control
  • Separator
  • Sidebar
  • Skeleton
  • Slider
  • Spinners
  • Stats
  • Stepper
  • Survey
  • Table
  • Tabs
  • Time picker
  • Timeline
  • Timer button
  • Toasts
  • Tooltip
  • Transfer list
  • Tree