GitHubGitHub
← All components
Forms / component

Tree select

A hierarchy picker: flat { id, parentId } nodes rendered as an expandable tree in a floating panel.

ExpandedCollapsedToned nodes
<TreeSelect nodes={projects} bind:value placeholder="Pick a project" />

Installation

pnpm add @chanrg/4ui

Import the stylesheet once, at the root of your app:

import '@chanrg/4ui/styles.css';

Usage

import { TreeSelect } from '@chanrg/4ui';<TreeSelect nodes={projects} bind:value placeholder="Pick a project" />

API reference

Props

PropTypeDefaultDescription
nodes{ id, label, parentId?, tone? }[][]Flat node list; parentId builds the tree.
valuestring | null ($bindable)nullSelected node id.

CSS variables

VariableDescription
--4ui-surfacePrimary component surface.
--4ui-textPrimary foreground color.
--4ui-borderDefault control and panel border.

Accessibility

  • role="tree"/"treeitem" with aria-expanded on branch nodes.
  • Expand toggles are separate labelled buttons from selection.

Dependencies

Icon, dismiss/portal/floating primitives