Title: TreeSelect
Published: March 9, 2021
Last modified: October 14, 2026

---

# TreeSelect

## In this article

 * [Props](https://developer.wordpress.org/block-editor/reference-guides/components/tree-select/?output_format=md#props)
    - [children](https://developer.wordpress.org/block-editor/reference-guides/components/tree-select/?output_format=md#children)
    - [disabled](https://developer.wordpress.org/block-editor/reference-guides/components/tree-select/?output_format=md#disabled)
    - [hideLabelFromVision](https://developer.wordpress.org/block-editor/reference-guides/components/tree-select/?output_format=md#hidelabelfromvision)
    - [help](https://developer.wordpress.org/block-editor/reference-guides/components/tree-select/?output_format=md#help)
    - [label](https://developer.wordpress.org/block-editor/reference-guides/components/tree-select/?output_format=md#label)
    - [labelPosition](https://developer.wordpress.org/block-editor/reference-guides/components/tree-select/?output_format=md#labelposition)
    - [noOptionLabel](https://developer.wordpress.org/block-editor/reference-guides/components/tree-select/?output_format=md#nooptionlabel)
    - [onChange](https://developer.wordpress.org/block-editor/reference-guides/components/tree-select/?output_format=md#onchange)
    - [options](https://developer.wordpress.org/block-editor/reference-guides/components/tree-select/?output_format=md#options)
    - [prefix](https://developer.wordpress.org/block-editor/reference-guides/components/tree-select/?output_format=md#prefix)
    - [selectedId](https://developer.wordpress.org/block-editor/reference-guides/components/tree-select/?output_format=md#selectedid)
    - [size](https://developer.wordpress.org/block-editor/reference-guides/components/tree-select/?output_format=md#size)
    - [suffix](https://developer.wordpress.org/block-editor/reference-guides/components/tree-select/?output_format=md#suffix)
    - [tree](https://developer.wordpress.org/block-editor/reference-guides/components/tree-select/?output_format=md#tree)
    - [variant](https://developer.wordpress.org/block-editor/reference-guides/components/tree-select/?output_format=md#variant)

See the [WordPress Storybook](https://wordpress.github.io/gutenberg/?path=/docs/components-treeselect--docs)
for more detailed, interactive documentation.

Generates a hierarchical select input.

    ```language-jsx
    import { useState } from 'react';
    import { TreeSelect } from '@wordpress/components';

    const MyTreeSelect = () => {
        const [ page, setPage ] = useState( 'p21' );

        return (
            <TreeSelect
                label="Parent page"
                noOptionLabel="No parent page"
                onChange={ ( newPage ) => setPage( newPage ) }
                selectedId={ page }
                tree={ [
                    {
                        name: 'Page 1',
                        id: 'p1',
                        children: [
                            { name: 'Descend 1 of page 1', id: 'p11' },
                            { name: 'Descend 2 of page 1', id: 'p12' },
                        ],
                    },
                    {
                        name: 'Page 2',
                        id: 'p2',
                        children: [
                            {
                                name: 'Descend 1 of page 2',
                                id: 'p21',
                                children: [
                                    {
                                        name: 'Descend 1 of Descend 1 of page 2',
                                        id: 'p211',
                                    },
                                ],
                            },
                        ],
                    },
                ] }
            />
        );
    }
    ```

## 󠀁[Props](https://developer.wordpress.org/block-editor/reference-guides/components/tree-select/?output_format=md#props)󠁿

### 󠀁[children](https://developer.wordpress.org/block-editor/reference-guides/components/tree-select/?output_format=md#children)󠁿

 * Type: `ReactNode`
 * Required: No

As an alternative to the `options` prop, `optgroup`s and `options` can be
 passed
in as `children` for more customizability.

### 󠀁[disabled](https://developer.wordpress.org/block-editor/reference-guides/components/tree-select/?output_format=md#disabled)󠁿

 * Type: `boolean`
 * Required: No
 * Default: `false`

If true, the `input` will be disabled.

### 󠀁[hideLabelFromVision](https://developer.wordpress.org/block-editor/reference-guides/components/tree-select/?output_format=md#hidelabelfromvision)󠁿

 * Type: `boolean`
 * Required: No
 * Default: `false`

If true, the label will only be visible to screen readers.

### 󠀁[help](https://developer.wordpress.org/block-editor/reference-guides/components/tree-select/?output_format=md#help)󠁿

 * Type: `ReactNode`
 * Required: No

Additional description for the control.

Only use for meaningful description or instructions for the control. An element 
containing the description will be programmatically associated to the BaseControl
by the means of an `aria-describedby` attribute.

### 󠀁[label](https://developer.wordpress.org/block-editor/reference-guides/components/tree-select/?output_format=md#label)󠁿

 * Type: `ReactNode`
 * Required: No

If this property is added, a label will be generated using label property as the
content.

### 󠀁[labelPosition](https://developer.wordpress.org/block-editor/reference-guides/components/tree-select/?output_format=md#labelposition)󠁿

 * Type: `"top" | "bottom" | "side" | "edge"`
 * Required: No
 * Default: `'top'`

The position of the label.

### 󠀁[noOptionLabel](https://developer.wordpress.org/block-editor/reference-guides/components/tree-select/?output_format=md#nooptionlabel)󠁿

 * Type: `string`
 * Required: No

If this property is added, an option will be added with this label to represent 
empty selection.

### 󠀁[onChange](https://developer.wordpress.org/block-editor/reference-guides/components/tree-select/?output_format=md#onchange)󠁿

 * Type: `((value: string, extra?: { event?: ChangeEvent<HTMLSelectElement, Element
   >; }) => void) | undefined`
 * Required: No

A function that receives the value of the new option that is being selected as input.

### 󠀁[options](https://developer.wordpress.org/block-editor/reference-guides/components/tree-select/?output_format=md#options)󠁿

 * Type: `readonly ({ label: string; value: string; } & Omit<OptionHTMLAttributes
   <HTMLOptionElement>, "label" | "value">)[]`
 * Required: No

An array of option property objects to be rendered,
 each with a `label` and `value`
property, as well as any other `<option>` attributes.

### 󠀁[prefix](https://developer.wordpress.org/block-editor/reference-guides/components/tree-select/?output_format=md#prefix)󠁿

 * Type: `ReactNode`
 * Required: No

Renders an element on the left side of the input.

By default, the prefix is aligned with the edge of the input border, with no padding.

If you want to apply standard padding in accordance with the size variant, wrap 
the element in the provided `<InputControlPrefixWrapper>` component.

    ```language-jsx
    import {
      __experimentalInputControl as InputControl,
      __experimentalInputControlPrefixWrapper as InputControlPrefixWrapper,
    } from '@wordpress/components';

    <InputControl
      prefix={<InputControlPrefixWrapper>@</InputControlPrefixWrapper>}
    />
    ```

### 󠀁[selectedId](https://developer.wordpress.org/block-editor/reference-guides/components/tree-select/?output_format=md#selectedid)󠁿

 * Type: `string`
 * Required: No

The id of the currently selected node.

### 󠀁[size](https://developer.wordpress.org/block-editor/reference-guides/components/tree-select/?output_format=md#size)󠁿

 * Type: `"default" | "small" | "compact"`
 * Required: No
 * Default: `'default'`

Adjusts the size of the input.

### 󠀁[suffix](https://developer.wordpress.org/block-editor/reference-guides/components/tree-select/?output_format=md#suffix)󠁿

 * Type: `ReactNode`
 * Required: No

Renders an element on the right side of the input.

By default, the suffix is aligned with the edge of the input border, with no padding.

If you want to apply standard padding in accordance with the size variant, wrap 
the element in the provided `<InputControlSuffixWrapper>` component.

    ```language-jsx
    import {
      __experimentalInputControl as InputControl,
      __experimentalInputControlSuffixWrapper as InputControlSuffixWrapper,
    } from '@wordpress/components';

    <InputControl
      suffix={<InputControlSuffixWrapper>%</InputControlSuffixWrapper>}
    />
    ```

### 󠀁[tree](https://developer.wordpress.org/block-editor/reference-guides/components/tree-select/?output_format=md#tree)󠁿

 * Type: `Tree[]`
 * Required: No

An array containing the tree objects with the possible nodes the user can select.

### 󠀁[variant](https://developer.wordpress.org/block-editor/reference-guides/components/tree-select/?output_format=md#variant)󠁿

 * Type: `"default" | "minimal"`
 * Required: No
 * Default: `'default'`

The style variant of the control.

First published

March 9, 2021

Last updated

October 14, 2026

Edit article

[ Improve it on GitHub: TreeSelect ](https://github.com/WordPress/gutenberg/edit/trunk/packages/components/src/tree-select/README.md)

[  Previous: TreeGrid](https://developer.wordpress.org/block-editor/reference-guides/components/tree-grid/)

[  Next: Truncate](https://developer.wordpress.org/block-editor/reference-guides/components/truncate/)