Skip to content

Hierarchical Combobox

An autocomplete tag editor demonstrating hierarchical state management for complex UI interactions. The combobox tracks whether it’s open or closed, what’s highlighted, and what’s selected — and shows how nesting simplifies the handling of shared keyboard events across sub-states.

The combobox has an Open state with child states for different interaction modes (typing, navigating with arrow keys, etc.). In the nested variant, keyboard events like Escape and Enter are defined once on the Open parent and propagate to all children automatically.

In the flattened variant, every sub-state of Open must explicitly handle those shared events. The machine is longer but every transition is visible at a glance without tracing through a parent hierarchy.