Skip to content

[combobox] Support primitive item values#4985

Open
atomiks wants to merge 4 commits into
mui:masterfrom
atomiks:claude/elated-dhawan-7d59ce
Open

[combobox] Support primitive item values#4985
atomiks wants to merge 4 commits into
mui:masterfrom
atomiks:claude/elated-dhawan-7d59ce

Conversation

@atomiks

@atomiks atomiks commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Alternative to #4686.

Partially addresses #3594. Related to #4419 and #4735.

This lets Combobox use primitive values with supported object items, such as items={[{ value: "banana", label: "Banana" }]} with defaultValue="banana" or <Combobox.Item value="banana" />.

The public API stays the same: Combobox infers primitive values from supported item shapes instead of adding an itemValue prop. Select is unchanged in this PR.

Unlike #4686, this keeps the existing index and value tracking (selectedIndex in the store, allValuesRef) instead of reworking it, so the change stays small and contained.

Changes

  • Support primitive Combobox values for { value, label } items.
  • Use inferred values for selection, highlight, scroll into view, typeahead, autofill, and labels, while preserving the exact rendered value shape for <Combobox.Item value={item}>.
  • Keep Combobox item values available while filtering, closing, using inline lists, or rendering without items.
  • Add a value-shape test matrix across item types (primitive, primitive key, whole { value, label } item, arbitrary object with itemToStringLabel/itemToStringValue, and object-valued labeled item) covering selection, highlight, labels, custom equality, autofill, and virtualized cases.

Notes

  • This only infers values for the supported { value, label } item shape.
  • Other object item shapes still need matching values or isItemEqualToValue.

@atomiks atomiks force-pushed the claude/elated-dhawan-7d59ce branch from 16898c7 to 914e245 Compare June 9, 2026 03:43
@pkg-pr-new

pkg-pr-new Bot commented Jun 9, 2026

Copy link
Copy Markdown

commit: c05db74

@netlify

netlify Bot commented Jun 9, 2026

Copy link
Copy Markdown

Deploy Preview for base-ui ready!

Name Link
🔨 Latest commit 16898c7
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/6a278ba88363b1000812c39c
😎 Deploy Preview https://deploy-preview-4985--base-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@code-infra-dashboard

code-infra-dashboard Bot commented Jun 9, 2026

Copy link
Copy Markdown

Bundle size

Bundle Parsed size Gzip size
@base-ui/react 🔺+1.18KB(+0.25%) 🔺+351B(+0.24%)

Details of bundle changes

Performance

Total duration: 1,153.94 ms -220.06 ms(-16.0%) | Renders: 50 (+0) | Paint: 1,745.84 ms -329.15 ms(-15.9%)

Test Duration Renders
Tabs mount (200 instances) 215.69 ms ▼-55.53 ms(-20.5%) 4 (+0)
Menu mount (300 instances) 130.19 ms ▼-34.16 ms(-20.8%) 2 (+0)
Menu open (500 items) 62.66 ms ▼-26.58 ms(-29.8%) 12 (+0)

9 tests within noise — details


Check out the code infra dashboard for more information about this PR.

@netlify

netlify Bot commented Jun 9, 2026

Copy link
Copy Markdown

Deploy Preview for base-ui ready!

Name Link
🔨 Latest commit c05db74
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/6a28df9fa56f750008ecd552
😎 Deploy Preview https://deploy-preview-4985--base-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@atomiks atomiks added type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature. component: combobox Changes related to the combobox component. labels Jun 9, 2026
@atomiks atomiks marked this pull request as ready for review June 9, 2026 06:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: combobox Changes related to the combobox component. type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant