Repository navigation
[select] Fix items type definition for groups - #3884
Merged
Merged
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. |
aarongarciah
force-pushed
the
docs-select-grouped-demo
branch
3 times, most recently
from
January 29, 2026 10:54
4de4785 to
8b6fac2
Compare
items type definition for groups
There was a problem hiding this comment.
Pull request overview
This PR extends the Select component’s items typing to support grouped item data structures and adds documentation + demos illustrating grouped usage.
Changes:
- Generalizes the utility types in
resolveValueLabelto accept grouped items via a sharedGroupinterface and reuses this in Select’s store and root props. - Updates Select’s public API typing (
SelectRootProps.itemsand generated JSON reference) to include grouped item shapes, mirroring existing Combobox/Autocomplete support. - Adds a new “Grouped” section, navigation entry, and CSS Modules + Tailwind demos for grouped Select usage in the docs.
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
packages/react/src/utils/resolveValueLabel.tsx |
Extends ItemsInput to include ReadonlyArray<Group<any>> / ReadonlyArray<Group<LabeledItem>>, defines and exports a reusable Group<Item> interface, and uses isGroupedItems to support grouped arrays in hasNullItemLabel and resolveSelectedLabel. |
packages/react/src/select/store.ts |
Aligns the Select store’s State['items'] type with the new grouped shapes by allowing ReadonlyArray<Group<any>> and ReadonlyArray<Group<{ label: React.ReactNode; value: any }>>, reusing the shared Group type. |
packages/react/src/select/root/SelectRoot.tsx |
Imports Group from the shared utility and updates SelectRootProps['items'] to accept records, flat labeled arrays, and grouped arrays (both generic Group<any> and labeled Group<{ label; value }>), matching the underlying store and resolver behavior. |
docs/src/app/(docs)/react/components/select/page.mdx |
Adds a “Grouped” documentation section describing grouped data structures, includes an example ProduceGroupItem interface, and wires in the new DemoSelectGrouped demo. |
docs/src/app/(docs)/react/components/select/demos/grouped/tailwind/index.tsx |
Introduces a Tailwind-based grouped Select demo that passes a grouped items array to <Select.Root> and renders <Select.Group> / <Select.GroupLabel> / <Select.Item> from the same dataset. |
docs/src/app/(docs)/react/components/select/demos/grouped/index.ts |
Registers DemoSelectGrouped via createDemoWithVariants, consistent with other Select demos. |
docs/src/app/(docs)/react/components/select/demos/grouped/css-modules/index.tsx |
Adds a CSS Modules–styled grouped Select demo mirroring the Tailwind variant, using the grouped items array and group components for headings and items. |
docs/src/app/(docs)/react/components/select/demos/grouped/css-modules/index.module.css |
Provides the styling for the CSS Modules grouped demo (field layout, trigger, popup, grouped list, sticky group labels, items, and scroll arrows). |
docs/src/app/(docs)/react/components/page.mdx |
Updates the Select section’s outline to include a “Grouped” entry alongside existing topics like Multiple selection and Object values. |
docs/reference/generated/select-root.json |
Updates the generated API reference for SelectRoot.items to document the new union of record, flat labeled array, and grouped array shapes (including Group[] and Group<{ label, value }>[]). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
atomiks
force-pushed
the
docs-select-grouped-demo
branch
from
February 22, 2026 11:01
8b6fac2 to
7dd06d5
Compare
atomiks
force-pushed
the
docs-select-grouped-demo
branch
from
February 24, 2026 04:01
167ca88 to
11e3455
Compare
atomiks
force-pushed
the
docs-select-grouped-demo
branch
from
February 24, 2026 04:25
776c60f to
62b9cd8
Compare
atomiks
marked this pull request as ready for review
February 24, 2026 05:27
atomiks
requested review from
atomiks,
colmtuite and
michaldudak
as code owners
February 24, 2026 05:27
atomiks
approved these changes
Feb 24, 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.
While adding a grouped demo in the Select docs, I realized the
itemsprop didn't accept an array of groups.This change expands the
itemstype to also accept an array of groups with these shapes: