MiHCM
primitives/@mihcm/ui·v0.21.0·stable

OrgSelector

Form-field-shaped picker for hierarchical org structures (departments, teams, business units, locations). Five variants (popover/inline/columns/drawer/command) and four selection modes (single/multi/cascade/include-descendants) compose freely. Full WAI-ARIA TreeView keyboard model, lazy loading, optional virtualization for large trees.

Props

The full prop API for OrgSelector. Same surface in web and React Native — bundlers pick the right variant via the react-native export condition.

PropTypeDefaultDescriptionSince
dataOrgNode[]Tree to render. Omit and use `loadChildren` for a fully lazy tree.0.20.0
loadChildren(node: OrgNode) => Promise<OrgNode[]>Lazy-load children for nodes flagged with `hasChildren: true`. Called once per node on first expand.0.20.0
variant'popover' | 'inline' | 'columns' | 'drawer' | 'command' | 'breadcrumb-drill''popover'Visual shell. Mode and triggerDisplay are independent — every combination is supported.0.20.0
mode'single' | 'multi' | 'cascade' | 'include-descendants''single'Selection semantics. See Usage → Modes for value shapes.0.20.0
pickable'any-level' | 'leaf-only''any-level'`leaf-only` makes parents expandable but read-only.0.20.0
triggerDisplay'chips' | 'breadcrumb' | 'path' | 'count''chips'How the closed trigger renders the selection. `breadcrumb` shows `Group › Engineering › Platform`; `path` uses `/` separators; `count` shows `N selected`.0.20.0
pathSeparatorReactNodeOverride the separator between path segments. Defaults to `›` for breadcrumb and `/` for path.0.20.0
autoVirtualizeThresholdnumber1000Total node count above which the renderer auto-enables virtualization (caps visible rows and prompts to narrow with search). Set `Infinity` to disable.0.20.0
valuestring | string[] | nullControlled value. `string | null` in single mode; `string[]` otherwise.0.20.0
defaultValuestring | string[] | nullUncontrolled initial value.0.20.0
onChange(next: string | string[] | null) => voidFires whenever the selection changes.0.20.0
labelReactNodeForm-field label. Renders inside `popover`, `inline`, and `drawer` shells.0.20.0
placeholderstringPlaceholder text on the closed popover trigger.0.20.0
helpTextReactNodeHelp text below the field. Wired via `aria-describedby`.0.20.0
errorTextReactNodeError text. Toggles `aria-invalid` styling.0.20.0
requiredbooleanMarks the field as required (renders asterisk + `aria-required`).0.20.0
disabledbooleanDisables every interactive affordance.0.20.0
searchablebooleanShow the typeahead search input. Defaults to `true` for trees with ≥ 7 roots.0.20.0
matcher(node: OrgNode, query: string) => booleanCustom matcher. Defaults to case-insensitive substring on `label`.0.20.0
disabledKeysreadonly string[]Keys that cannot be toggled, even when otherwise selectable.0.20.0
defaultExpandedKeysreadonly string[]Keys expanded on first render.0.20.0
expandAllbooleanForce every parent open and disable collapse.0.20.0
expandOnValuebooleantrueAuto-expand the ancestry path of the current value(s) when opening.0.20.0
virtualizedbooleanVirtualize the flattened rows (requires `@tanstack/react-virtual`). Use for trees with >1k visible nodes.0.20.0
maxVisibleChipsnumberMax visible chip count in the multi-select trigger before "…+N".0.20.0
drawerSide'left' | 'right' | 'bottom''bottom'Side the drawer slides in from in `drawer` variant.0.20.0

Import

import { OrgSelector, type OrgNode } from '@mihcm/ui/OrgSelector';