Data Entryduskmoonimplemented7 demos

TreeSelect

TreeSelect combines tree selection with compact form input behavior.

Import@duskmoon-dev/components/tree-select
9API sections
55documented props
5behavior scenarios
Key API
allowCleardefaultOpendefaultValuedefaultExpandedKeysdefaultTreeExpandedKeysdisabled

Usage

When to use

  • Use it inside forms, filters, settings, and any workflow that captures user input.
  • Prefer controlled props when the value must stay synchronized with application state.

Implementation notes

StylesheetImport @duskmoon-dev/components/styles.css once in the app or docs shell.
StateStart with default props for static examples, then switch to controlled props when state must be shared.
ThemeThe preview inherits the active DuskMoon data-theme value from the docs layout.

Features

Controlled and uncontrolled usage

Documents default values, value props, and change callbacks for form integration.

Validation state

Surfaces status, size, disabled, and option data patterns where the component supports them.

Primary API surface

TreeSelect is most often configured through `allowClear`, `defaultOpen`, `defaultValue`, `defaultExpandedKeys`.

Covered behavior

Renders treeData and selects a single value

Feature Demos

Feature demos are authored for the component page, then supplemented with behavior scenarios from the component test coverage.

Preview

Basic usage

authored

Import the component stylesheet and TreeSelect from its package subpath, then render it with the core props.

Source
import "@duskmoon-dev/components/styles.css";
import { TreeSelect } from "@duskmoon-dev/components/tree-select";

export function Example() {
  return (<TreeSelect
  defaultValue="enabled"
/>);
}
Preview

Renders treeData and selects a single value

test-backed

TreeSelect scenario from the component test coverage: renders treedata and selects a single value.

Source
import "@duskmoon-dev/components/styles.css";
import { TreeSelect } from "@duskmoon-dev/components/tree-select";

export function TreeSelectRendersTreeDataAndSelectsDemo() {
  return (<TreeSelect
  // Renders treeData and selects a single value
  defaultValue="enabled"
/>);
}
Preview

Supports multiple treeCheckable selection and allowClear

test-backed

TreeSelect scenario from the component test coverage: supports multiple treecheckable selection and allowclear.

Source
import "@duskmoon-dev/components/styles.css";
import { TreeSelect } from "@duskmoon-dev/components/tree-select";

export function TreeSelectSupportsMultipleTreeCheckableSelectionDemo() {
  return (<TreeSelect
  // Supports multiple treeCheckable selection and allowClear
  defaultValue="enabled"
/>);
}
Preview

Supports controlled value, search, filtering, and callbacks

test-backed

TreeSelect scenario from the component test coverage: supports controlled value, search, filtering, and callbacks.

Source
import "@duskmoon-dev/components/styles.css";
import { TreeSelect } from "@duskmoon-dev/components/tree-select";

export function TreeSelectSupportsControlledValueSearchDemo() {
  return (<TreeSelect
  // Supports controlled value, search, filtering, and callbacks
  defaultValue="enabled"
/>);
}
Preview

Supports expansion control and loadData

test-backed

TreeSelect scenario from the component test coverage: supports expansion control and loaddata.

Source
import "@duskmoon-dev/components/styles.css";
import { TreeSelect } from "@duskmoon-dev/components/tree-select";

export function TreeSelectSupportsExpansionControlAndDemo() {
  return (<TreeSelect
  // Supports expansion control and loadData
  defaultValue="enabled"
/>);
}
Preview

Exposes TreeNode and checked strategy constants

test-backed

TreeSelect scenario from the component test coverage: exposes treenode and checked strategy constants.

Source
import "@duskmoon-dev/components/styles.css";
import { TreeSelect } from "@duskmoon-dev/components/tree-select";

export function TreeSelectExposesTreeNodeAndCheckedDemo() {
  return (<TreeSelect
  // Exposes TreeNode and checked strategy constants
  defaultValue="enabled"
/>);
}
Preview
Sunshine Theme
Moonlight Theme

Theme aware

authored

Docs previews inherit the DuskMoon data-theme value. Use the header switch to compare light and dark rendering.

Source
<div data-theme="sunshine">
  <TreeSelect
  defaultValue="enabled"
/>
</div>

<div data-theme="moonlight">
  <TreeSelect
  defaultValue="enabled"
/>
</div>

API

The API reference below lists every parsed exported type or interface for TreeSelect. Start with `allowClear`, `defaultOpen`, `defaultValue`, `defaultExpandedKeys` for common usage.

Types: packages/components/src/components/tree-select/TreeSelect.types.tsScenarios: packages/components/src/components/tree-select/TreeSelect.test.tsx
TreeSelectPropsinterface extends < T extends TreeSelectDataNode = TreeSelectDataNode, > extends Omit< ComponentProps<"div">, "children" | "defaultValue" | "onChange" | "onSelect" >
PropTypeRequiredDescription
allowClearbooleanNoallowClear configures TreeSelect.
childrenReactNodeNochildren configures TreeSelect.
defaultOpenbooleanNodefaultOpen configures TreeSelect.
defaultValueTreeSelectRawValueNodefaultValue configures TreeSelect.
defaultExpandedKeysTreeSelectValue[]NodefaultExpandedKeys configures TreeSelect.
defaultTreeExpandedKeysTreeSelectValue[]NodefaultTreeExpandedKeys configures TreeSelect.
disabledbooleanNodisabled configures TreeSelect.
expandedKeysTreeSelectValue[]NoexpandedKeys configures TreeSelect.
filterTreeNodeboolean | ((inputValue: string, node: T) => boolean)NofilterTreeNode configures TreeSelect.
loadData(node: T) => Promise<unknown> | unknownNoloadData configures TreeSelect.
multiplebooleanNomultiple configures TreeSelect.
onChange(NoonChange configures TreeSelect.
valueTreeSelectRawValue | undefined,Yesvalue configures TreeSelect.
labelReactNode | ReactNode[],Yeslabel configures TreeSelect.
extraTreeSelectChangeExtra<T>,Yesextra configures TreeSelect.
onDropdownVisibleChange(open: boolean) => voidNoonDropdownVisibleChange configures TreeSelect.
onSearch(value: string) => voidNoonSearch configures TreeSelect.
onSelect(NoonSelect configures TreeSelect.
valueTreeSelectValue,Yesvalue configures TreeSelect.
nodeT,Yesnode configures TreeSelect.
extraTreeSelectChangeExtra<T>,Yesextra configures TreeSelect.
openbooleanNoopen configures TreeSelect.
placeholderReactNodeNoplaceholder configures TreeSelect.
searchValuestringNosearchValue configures TreeSelect.
showSearchbooleanNoshowSearch configures TreeSelect.
treeCheckablebooleanNotreeCheckable configures TreeSelect.
treeCheckedStrategyTreeSelectCheckedStrategyNotreeCheckedStrategy configures TreeSelect.
treeDataT[]NotreeData configures TreeSelect.
treeDefaultExpandAllbooleanNotreeDefaultExpandAll configures TreeSelect.
treeExpandedKeysTreeSelectValue[]NotreeExpandedKeys configures TreeSelect.
valueTreeSelectRawValueNovalue configures TreeSelect.
TreeSelectDataNodeinterface
PropTypeRequiredDescription
valueTreeSelectValueNovalue configures TreeSelect.
keyTreeSelectValueNokey configures TreeSelect.
titleReactNodeNotitle configures TreeSelect.
labelReactNodeNolabel configures TreeSelect.
childrenTreeSelectDataNode[]Nochildren configures TreeSelect.
disabledbooleanNodisabled configures TreeSelect.
disableCheckboxbooleanNodisableCheckbox configures TreeSelect.
selectablebooleanNoselectable configures TreeSelect.
checkablebooleanNocheckable configures TreeSelect.
isLeafbooleanNoisLeaf configures TreeSelect.
classNamestringNoclassName configures TreeSelect.
TreeSelectNodePropsinterface extends Omit< ComponentProps<"div">, "title" | "onSelect" >
PropTypeRequiredDescription
titleReactNodeNotitle configures TreeSelect.
valueTreeSelectValueYesvalue configures TreeSelect.
childrenReactNodeNochildren configures TreeSelect.
disabledbooleanNodisabled configures TreeSelect.
disableCheckboxbooleanNodisableCheckbox configures TreeSelect.
selectablebooleanNoselectable configures TreeSelect.
checkablebooleanNocheckable configures TreeSelect.
isLeafbooleanNoisLeaf configures TreeSelect.
TreeSelectChangeExtrainterface extends < T extends TreeSelectDataNode = TreeSelectDataNode, >
PropTypeRequiredDescription
triggerValueTreeSelectValueNotriggerValue configures TreeSelect.
selectedbooleanNoselected configures TreeSelect.
checkedbooleanNochecked configures TreeSelect.
triggerNodeTNotriggerNode configures TreeSelect.
allCheckedNodesT[]NoallCheckedNodes configures TreeSelect.
TreeSelectValuetype
string | number
TreeSelectRawValuetype
TreeSelectValue | TreeSelectValue[]
TreeSelectCheckedStrategytype
"SHOW_ALL" | "SHOW_PARENT" | "SHOW_CHILD"
TreeSelectNodeComponenttype
ForwardRefExoticComponent< TreeSelectNodeProps & RefAttributes<HTMLDivElement> >
TreeSelectComponenttype
(< T extends TreeSelectDataNode = TreeSelectDataNode, >( props: TreeSelectProps<T> & RefAttributes<HTMLDivElement>, ) => ReactElement | null) & { TreeNode: TreeSelectNodeComponent