question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[ToggleButton] Selected color should be take in account without '! important'

See original GitHub issue

When you want to use a specific color on the selected toggleButton, you must add important for the color to be taken into account

Example with codesandbox

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
TomPradatcommented, Jun 10, 2020

@oliviertassinari Shouldn’t the classes override win over the default style ?

From the codesandbox:

<ToggleButton
        value="left"
        aria-label="left aligned"
        classes={{ selected: classes.buttonColor }}
      >

Indeed the specificy is less important because you have one class .makeStyles-buttonColor-1 vs .MuiToggleButton-root.Mui-selected

0reactions
TomPradatcommented, Jun 10, 2020

Alright, I missed that, thanks 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

[ToggleButton] Selected color should be take in account ...
When you want to use a specific color on the selected toggleButton, you must add important for the color to be taken into...
Read more >
Material UI Toggle Button - can't change background color ...
I'm using the classes prop on the ToggleButton component, and using the "selected" rule within that prop.
Read more >
What Makes A Great Toggle Button? (Case Study, Part 2)
If you choose to use color as the main lead, we suggest you use a combination of a saturated lively color (ideally corresponding...
Read more >
The best tools to create effective toggle buttons
Explore what a toggle button is, learn when to use a toggle button, and find the tools that help you create effective toggles....
Read more >
ToggleButton (On/Off) Tutorial With Example In Android
To check current state of a toggle button programmatically we use isChecked() method. This method returns a Boolean value either true or false....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found