Skip to content
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

[material-ui][Radio] Large size shows warning in console #40143

Open
2 tasks done
mbehtemam-dsv opened this issue Dec 8, 2023 · 3 comments
Open
2 tasks done

[material-ui][Radio] Large size shows warning in console #40143

mbehtemam-dsv opened this issue Dec 8, 2023 · 3 comments
Assignees
Labels
component: button This is the name of the generic UI component, not the React module! enhancement This is not a bug, nor a new feature

Comments

@mbehtemam-dsv
Copy link

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Steps to reproduce 🕹

Link to live example: https://stackblitz.com/edit/react-hbyt9f-iryn4i?file=Demo.tsx

I've created new size for Radio button , the large size , but I got this warning in chrome developer console. It seems it's because of this line of code

Here is the warning :

react.development.js:209 Warning: Failed prop type: Invalid prop `fontSize` of value `large` supplied to `RadioButtonIcon`, expected one of ["small","medium"].
    at RadioButtonIcon (http://localhost:5173/node_modules/.vite/deps/chunk-HMV62V6O.js?v=72451cad:130:5)
    at Radio2 (http://localhost:5173/node_modules/.vite/deps/chunk-HMV62V6O.js?v=72451cad:240:17)
    at label

I've created a Stackblitz live demo so you can check it.

Current behavior 😯

It show warning in console for

Expected behavior 🤔

It should accept custom size without showing warning.

Context 🔦

No response

Your environment 🌎

npx @mui/envinfo
  Don't forget to mention which browser you used.
  Output from `npx @mui/envinfo` goes here.
@mbehtemam-dsv mbehtemam-dsv added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Dec 8, 2023
@zannager zannager added the component: button This is the name of the generic UI component, not the React module! label Dec 8, 2023
@PunitSoniME
Copy link
Contributor

@mbehtemam-dsv

You can set custom size, check this https://mui.com/material-ui/react-radio-button/#size
The third radio element is custom sized

@mbehtemam-dsv
Copy link
Author

@PunitSoniME Thanks for your reply , but that's not what I want , I would like to change it via theme and pass the size="large" as an prop , if you check the stackblitz you can see I already implemented it but I got warning.

@DiegoAndai DiegoAndai assigned DiegoAndai and unassigned mj12albert Dec 12, 2023
@DiegoAndai DiegoAndai changed the title New size for radio button shows warning in console [material-ui][Radio] Large size shows warning in console Dec 12, 2023
@DiegoAndai
Copy link
Member

DiegoAndai commented Dec 13, 2023

Hey @mbehtemam-dsv, thanks for the report!

As you mentioned, the warning comes from here as the size prop gets forwarded here. The icon looks large because the size prop ends up here. It actually works out of the box without any custom code: example.

The warning is safe to ignore for now. We should eliminate it, so I'm adding it to the v7 milestone, as we'll be doing design updates for that release. We're not doing it right now as there are workarounds, like the one @PunitSoniME mentioned.

@DiegoAndai DiegoAndai added enhancement This is not a bug, nor a new feature and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Dec 13, 2023
@DiegoAndai DiegoAndai added this to the Material UI: v7 draft milestone Dec 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: button This is the name of the generic UI component, not the React module! enhancement This is not a bug, nor a new feature
Projects
None yet
Development

No branches or pull requests

6 participants