Support object values in Select primitive#77861
Conversation
| { users.map( ( option ) => ( | ||
| <Select.Item | ||
| key={ option.value } | ||
| value={ option } |
There was a problem hiding this comment.
Passing the full item object to the Select.Item's value prop (instead of just option.value) is what makes the render function for the Select.Trigger receive a full item object.
|
Size Change: 0 B Total Size: 7.93 MB ℹ️ View Unchanged
|
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Flaky tests detected in 6a18eee. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/25672855028
|
What?
Updates the
Selectprimitive so it can be used with object item values, matching Base UI's value model more closely.Why?
Base UI Select supports object item values, but our wrapper previously typed item values as strings and default-rendered item text from the raw value. This was not a good API in hindsight, because most consumers will want to model their data with separate value/labels anyway. It also makes it impossible to receive the full item object when custom-rendering the
Trigger.How?
anyvalue typing.Select.Itemchildren to the rawvalue; item content should be provided explicitly.itemsarrays.Testing Instructions
npm run lint:js packages/ui/src/form/primitives/select.npm run test:unit packages/ui/src/form/primitives/select/test/index.test.tsx.npm run build.Design System/Components/Form/Primitives/Select.