The pages pattern
Track which page you’re on withuseState. Render different items depending on the active page. Push to the stack when an item is selected; pop from the stack when Escape or Backspace is pressed:
Reset the
search value when navigating to a new page so the new set of items is not pre-filtered by whatever the user typed previously.Breadcrumb badges
The Vercel example shows the active page stack as badges rendered above the input — a useful affordance so users know where they are:Show sub-items when searching
Sometimes you want sub-items to only appear when the user is actively searching — they are hidden at rest but surface during a query. UseuseCommandState to read the current search string and conditionally render:
SubItem returns null and the sub-items are not in the DOM. As soon as the user types, they appear and are scored alongside all other items.
