How/Why does the props affects the style on `ButtonGroup` and `IconButton`
See original GitHub issue- The issue is present in the latest release.
- I have searched the issues of this repository and believe that this is not a duplicate.
Current Behavior 😯
With MUI@5.0.2, styling for the border is using :not(:last-of-type)
in the selector. This implies that MUI is using class on and <button/>, which causs "href
property of Button
in a ButtonGroup
" and “IconButton in ButtonGroup has unstable style”.
Is this is a bug?
I found several incoherent behaviors working with ButtonGroup
and IconButton
:
- Property
href
changes the right border of element. (answer this on Stack Overflow 69488393) - Modularizing
IconButton
changes color of element. (answered on Stack Overflow 69485887) - Passing empty props changes color of element. (answered on Stack Overflow 69485887)
- Button in ButtonGroup
href
property changes right border.(answer this on Stack Overflow 69488393) - When all IconButton-s are on one side, the hover background of last IconButton will change.(answer this on Stack Overflow 69488977)
IconButton
(both MUI original and customized) inButtonGroup
will cause twoError/Warning
-s:(answer this on Stack Overflow #####)
I hosted a minimal environment with GitHub Pages .
Expected Behavior 🤔
The ButtonGroup
HOC converts IconButton
just like how it converts Button
.
Steps to Reproduce 🕹
- To check behavior: I hosted a minimal environment with GitHub Pages .
- To play with the source code
Fork the source code and
yarn start
(ornpm start
)
Context 🔦
I asked a question on Stack Overflow I added this to my MUI learning note
Your Environment 🌎
`npx @mui/envinfo`
System: OS: Windows 10 10.0.19042 = 20H2 Binaries: Node: 14.17.1 - C:\Program Files\nodejs\node.EXE Yarn: 1.22.15 - ~\AppData\Roaming\npm\yarn.CMD npm: 6.14.13 - C:\Program Files\nodejs\npm.CMD Browsers: Chrome: 92.0.4515.159 Edge: Spartan (44.19041.1023.0), Chromium (94.0.992.38) npmPackages: @emotion/react: ^11.4.1 => 11.4.1 @emotion/styled: ^11.3.0 => 11.3.0 @mui/core: 5.0.0-alpha.49 @mui/icons-material: ^5.0.1 => 5.0.1 @mui/material: ^5.0.2 => 5.0.2 @mui/private-theming: 5.0.1 @mui/styled-engine: 5.0.1 @mui/system: 5.0.2 @mui/types: 7.0.0 @mui/utils: 5.0.1 @types/react: ^17.0.0 => 17.0.27 react: ^17.0.2 => 17.0.2 react-dom: ^17.0.2 => 17.0.2 typescript: ^4.1.2 => 4.4.3 ``` Don't forget to mention which browser you used. Output from `npx @mui/envinfo` goes here. ```Issue Analytics
- State:
- Created 2 years ago
- Comments:12 (12 by maintainers)
Top Results From Across the Web
How/Why does the props affects the style on `ButtonGroup ...
I found several incoherent behaviors working with ButtonGroup and IconButton : Property href changes the right border of element. (answer this ...
Read more >ButtonGroup API - Material UI - MUI
The name MuiButtonGroup can be used when providing default props or style overrides in the theme. Props. Props of the native component are...
Read more >How to style button from MUI icon button - Stack Overflow
Here's an example of how to do this: import React from "react"; import { makeStyles } from "@material-ui/core/styles"; import IconButton ...
Read more >ButtonGroup | Primer React
Component props are documented on primer.style/react. Component does not have any unnecessary third-party dependencies.
Read more >Button - Chakra UI
ButtonGroup: Used to group buttons whose actions are related, with an option to flush ... Use the variant prop to change the visual...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I saw it some hours ago. And it is. I’ll close this thread then.
This looks like a regression with emotion, and the fact that we can no longer use :first-child
v4
https://github.com/mui-org/material-ui/blob/c545ccab7edfdf4a44d4ec2f4bf10ebc7fd00259/packages/material-ui/src/ButtonGroup/ButtonGroup.js#L44
v5
https://github.com/mui-org/material-ui/blob/808be083318cab05fa304157ba305d51051980c6/packages/mui-material/src/ButtonGroup/ButtonGroup.js#L83