Skip to content
v0.2.10

TreeSelect

Single selection from a hierarchical collection inside a popup.

Preview

Use TreeSelect

TreeSelect is a named export of @flood-md/react. Connect the package once, then import what you use.

First time here? Connect Flood
Example import style
tree-select.tsxTSX
"use client";

import { FloodRoot, TreeSelect } from "@flood-md/react";
import "@flood-md/react/styles.css";

export function Example() {
  return (
    <FloodRoot>
      <TreeSelect label="Destination" name="destination" items={[{value:"design",label:"Design",selectable:false,children:[{value:"foundations",label:"Foundations"},{value:"components",label:"Components"}]}]} />
    </FloodRoot>
  );
}

Design notes

  • This first version selects one item; Tree provides standalone multiple selection.
  • Values are globally unique and expansion remains independent of selection.

API reference

PropValuesDefault
labelstringRequired
hideLabelboolean—
itemsreadonly TreeItem[]Required
valuestring—
defaultValuestring—
onValueChange(value: string) => void—
placeholderstring—
namestring—
formstring—
requiredboolean—
disabledboolean—
readOnlyboolean—
invalidboolean—
status"error" | "warning" | "success" | "info"—
controlSize"sm" | "md" | "lg" | "xl"—
openboolean—
defaultOpenboolean—
onOpenChange(open: boolean) => void—
expandedValuesreadonly string[]—
defaultExpandedValuesreadonly string[]—
onExpandedValuesChange(values: string[]) => void—
emptyMessagestring—
invalidSelectionMessagestring—
Native HTML propsOmit<HTMLAttributes<HTMLDivElement>, "children" | "onChange" | "defaultValue">Forwarded
View TypeScript source