mui / material-ui

Material UI: Comprehensive React component library that implements Google's Material Design. Free forever.
https://mui.com/material-ui/
MIT License
93.91k stars 32.27k forks source link

[ButtonGroup][Joy] Borders don't work properly with non-matching variants #37809

Open Studio384 opened 1 year ago

Studio384 commented 1 year ago

Duplicates

Latest version

Steps to reproduce 🕹

Link to live example: https://codesandbox.io/s/admiring-james-kzmpdk?file=/demo.tsx

Steps:

  1. Create a button group
  2. Make a button deviate from the button group's variant and/or color

Current behavior 😯

Using the default props of the button group, the button group will try to apply a border to the button in the groups color, rather than adhering to the styling of the button itself.

The inverse happens when applying a different variant to the button group and adding a outlined button within it, which basically recreates #37574.

image

The buttons seem to rely on the button group styling where they shouldn't.

Expected behavior 🤔

The button defines the styles and color applied to it if they are set, and otherwise use the color and/or variant from the button group.

Context 🔦

Trying to make a button group with spacing where the primary action has a highlighted style.

Your environment 🌎

No response

siriwatknp commented 1 year ago

Thanks for reporting the issue. Let me see if it can be improved by using ::before and ::after instead of overriding the border of the button.