A single-select dropdown that presents options as an expandable tree. Search filters the hierarchy, expand/collapse works like base-tree, and the control integrates with Angular Forms via [(ngModel)] / formControlName.
Unlock it plus 90 pro blocks, widgets & layouts — $99 one-time. Lifetime updates, 14-day money-back guarantee.
Pass a nested SelectTreeNode[] to [nodes]. The form value is the selected node’s value.
Selected value: "us-ca"
Use onlyLeaf when folders should expand but only files (leaves) are selectable.
Selected value: null
Add clearable to show an x button that resets the value to null.
Run the following command to add this component to your project:
npx base-ui-cli add select-tree
For AI agents
Copy a prompt with the registry name, CLI install, and import — or add the Base UI MCP server.
npx -y base-ui-mcp
Base UI provides standalone components. Import the exact elements you want to use into your component.
// Install: npx base-ui-cli add select-tree
// Paths are relative to aliases.components (default: src/app/components)
import { SelectTreeComponent, SelectTreeNode } from './select-tree/select-tree.component';
@Component({
selector: 'app-your-component',
imports: [
SelectTreeComponent
],
template: `...`
})
export class YourComponent {} API for select-tree — generated from JSDoc in the library source.
| API | Member | Type | Default | Description |
|---|---|---|---|---|
SelectTreeNode | label | string | — | Display label. |
SelectTreeNode | value | unknown | — | Value written to the form control when this node is selected. |
SelectTreeNode | icon | string | — | Optional icon name from the icon sprite. |
SelectTreeNode | children | SelectTreeNode[] | — | Nested child nodes. |
SelectTreeNode | expanded | boolean | — | Whether the folder is expanded (ignored while a search query is active). |
SelectTreeNode | disabled | boolean | — | When true, the node cannot be selected. |
SelectTreeNode | data | Record<string, unknown> | — | Arbitrary payload attached to the node. |
base-select-tree | class | string | '' | Extra host classes merged via `cn()`. |
base-select-tree | nodes | SelectTreeNode[] | [] | Hierarchical nodes to display in the dropdown. |
base-select-tree | placeholder | unknown | 'Select…' | Placeholder shown when nothing is selected. |
base-select-tree | onlyLeaf | boolean | false | When true, only leaf nodes (no children) can be selected. |
base-select-tree | clearable | boolean | false | Shows a clear button when a value is selected. |
base-select-tree | disabled | boolean | false | Disables the control (also set by forms via `setDisabledState`). |
base-select-tree | (selectionChange) | unknown | null | — | Emitted with the selected value whenever selection changes (including clear). |
Content