-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
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
[docs][base-ui] Improve Select's country select demo #38983
Conversation
Netlify deploy previewBundle size report |
728e2f0
to
a255ca0
Compare
a255ca0
to
0352e38
Compare
@oliviertassinari It's because diff --git a/docs/data/base/components/select/UnstyledSelectRichOptions.tsx b/docs/data/base/components/select/UnstyledSelectRichOptions.tsx
index cd73f9736d..945d2c73cc 100644
--- a/docs/data/base/components/select/UnstyledSelectRichOptions.tsx
+++ b/docs/data/base/components/select/UnstyledSelectRichOptions.tsx
@@ -6,7 +6,17 @@ import { Popper } from '@mui/base';
export default function UnstyledSelectRichOptions() {
return (
- <CustomSelect placeholder="Select country…">
+ <CustomSelect
+ renderValue={(option) => {
+ if (option == null || option.value === null || option.value === undefined) {
+ return 'Select country…';
+ }
+ return `${option.label} (${option.value})`;
+ }}
+ >
+ <StyledOption key="none" value={undefined} label="">
+ None
+ </StyledOption>
{countries.map((c) => (
<StyledOption key={c.code} value={c.code} label={c.label}>
<img
Something else I noticed is that custom props (e.g. A fix could be: |
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.
Looks good 🙆♂️
A quick iteration on #38796 to polish the demo. This feels much clearer for me when reading.
Before: https://master--material-ui.netlify.app/base-ui/react-select/#selected-value-appearance
Preview: https://deploy-preview-38983--material-ui.netlify.app/base-ui/react-select/#selected-value-appearance
A side note, I have tried to make this
work to reproduce https://mui.com/material-ui/react-select/#filled-and-standard-variants but it didn't show the placeholder. Should we expect it to?
Screen.Recording.2023-09-14.at.20.33.19.mov