-
Notifications
You must be signed in to change notification settings - Fork 2
feat/select primitive multiselect #2775
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces multiselect functionality to the Select primitive component by creating a custom Radix Select implementation with enhanced multiselection capabilities.
- Extracts and modifies Radix UI Select primitive to support multiselection
- Updates Select component to handle both single and multiple value selection
- Refactors existing component dependencies to use the new custom primitive
Reviewed Changes
Copilot reviewed 20 out of 24 changed files in this pull request and generated 5 comments.
Show a summary per file
File | Description |
---|---|
packages/react/src/ui/Select/components/radix-ui/select.tsx | Creates custom Select primitive with multiselection support extracted from Radix UI |
packages/react/src/ui/Select/components/radix-ui/index.ts | Exports all components from custom Select primitive |
packages/react/src/ui/Select/components/Select.tsx | Updates main Select component to handle multiple values and use custom primitive |
packages/react/src/ui/Select/components/SelectItem.tsx | Adds checkbox support for multiselect items |
packages/react/src/ui/Select/components/SelectContent.tsx | Updates to use custom primitive and removes loading indicators |
packages/react/src/ui/Select/SelectContext.tsx | Enhances context to support multiple values |
packages/react/src/ui/Select/stories/select.stories.tsx | Adds multiselect story and updates imports |
packages/react/package.json | Adds new Radix UI dependencies for custom primitive |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
🔍 Visual review for your branch is published 🔍Here are the links to: |
e0034b3
to
a7c6719
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 20 out of 24 changed files in this pull request and generated 6 comments.
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
const isSelectedItem = | ||
context.value !== undefined && context.value === value |
Copilot
AI
Oct 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comparison doesn't handle multiselect mode correctly. When context.value
is an array (multiselect), this equality check will always be false. The logic should check if the value is included in the array when in multiselect mode.
Copilot uses AI. Check for mistakes.
const isSelectedItem = | ||
context.value !== undefined && context.value === value |
Copilot
AI
Oct 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same issue as above - this comparison in itemTextRefCallback
doesn't handle multiselect arrays correctly and will prevent proper text selection highlighting in multiselect mode.
Copilot uses AI. Check for mistakes.
open: isOpen, | ||
asList: props.asList, | ||
multiple: props.multiple || false, | ||
} as SelectContextType |
Copilot
AI
Oct 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid using type assertion (as SelectContextType
). Instead, ensure the contextValue
object properly satisfies the SelectContextType
interface without requiring a type assertion.
} as SelectContextType | |
} |
Copilot uses AI. Check for mistakes.
size-limit report 📦
|
a7c6719
to
4fc725c
Compare
4fc725c
to
bd2e8f8
Compare
"@radix-ui/number": "^1.1.1", | ||
"@radix-ui/primitive": "^1.1.2", | ||
"@radix-ui/react-collection": "^1.1.7", | ||
"@radix-ui/react-compose-refs": "^1.1.2", | ||
"@radix-ui/react-context": "^1.1.2", | ||
"@radix-ui/react-direction": "^1.1.1", | ||
"@radix-ui/react-dismissable-layer": "^1.1.10", | ||
"@radix-ui/react-focus-guards": "^1.1.2", | ||
"@radix-ui/react-focus-scope": "^1.1.7", | ||
"@radix-ui/react-hover-card": "^1.1.15", | ||
"@radix-ui/react-id": "^1.1.1", | ||
"@radix-ui/react-popper": "^1.2.7", | ||
"@radix-ui/react-portal": "^1.1.9", | ||
"@radix-ui/react-primitive": "^2.1.3", | ||
"@radix-ui/react-switch": "^1.2.6", | ||
"@radix-ui/react-use-callback-ref": "^1.1.1", | ||
"@radix-ui/react-use-controllable-state": "^1.2.2", | ||
"@radix-ui/react-use-layout-effect": "^1.1.1", | ||
"@radix-ui/react-use-previous": "^1.1.1", | ||
"@radix-ui/react-visually-hidden": "^1.2.3", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to add all of this? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, to create the custom radix select primitive replacement
Description
Screenshots (if applicable)
Screen.Recording.2025-10-07.at.14.22.43.mov
[Link to Figma Design](Figma URL here)
Implementation details
We needed to rewrite the SelectPrimitive to allow multiselection: Implmenetation from: https://github.com/radix-ui/primitives/blob/b3ee588dcb339d6c6ce524fcdd968c5eeb4e8458/packages/react/select/src/select.tsx