[autocomplete][combobox] Support external items mapping#3594
Draft
atomiks wants to merge 3 commits into
Draft
Conversation
commit: |
Bundle size report
Check out the code infra dashboard for more information about this PR. |
✅ Deploy Preview for base-ui ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
3d51da5 to
9204b7b
Compare
1 task
9204b7b to
9b79d6c
Compare
3bf75f9 to
4e7e58e
Compare
This was referenced Jun 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds support for the cmdk-style composition pattern without requiring
itemsonRoot, and without forcing the filtering/rendering to happen through a function child:Before this,
Autocompletecould support this shape reasonably well, but filtering had to happen externally.Comboboxonly had partial support and did not keep selection/highlight/empty-state behavior in sync.Implementation
Combobox.Itemfilters itself and returnsnullwhen it should not be shown.Combobox.Groupuseshiddeninstead of unmounting its children so item registration effects can still run.CompositeListmetadata for item values instead of maintaining a separate DOM-node-to-value map.Pros
Tradeoffs
Real
items-driven path.items, Combobox still needs to force-mount the popup on interaction so labels and selected indices can be registered from the rendered tree.itemsorfilteredItems, because unrendered rows are otherwise unknowable.Not really new / overstated
itemToStringLabelstory rather than a new requirement introduced by this approach.Validation
pnpm test:jsdom ComboboxRoot --no-watchpnpm test:jsdom AutocompleteRoot --no-watchpnpm typescriptpnpm eslint docs/reference/generated/combobox-empty.json packages/react/src/autocomplete/root/AutocompleteRoot.test.tsx packages/react/src/combobox/empty/ComboboxEmpty.tsx packages/react/src/combobox/group/ComboboxGroup.tsx packages/react/src/combobox/group/ComboboxGroupContext.ts packages/react/src/combobox/input/ComboboxInput.tsx packages/react/src/combobox/item/ComboboxItem.tsx packages/react/src/combobox/list/ComboboxList.tsx packages/react/src/combobox/popup/ComboboxPopup.tsx packages/react/src/combobox/positioner/ComboboxPositioner.tsx packages/react/src/combobox/root/AriaCombobox.tsx packages/react/src/combobox/root/ComboboxRoot.test.tsx packages/react/src/combobox/root/ComboboxRootContext.tsx packages/react/src/combobox/store.ts packages/react/src/combobox/trigger/ComboboxTrigger.tsx packages/react/src/composite/list/useCompositeListItem.ts