Button's custom color property
See original GitHub issueHi there!
I’ve added some new colors to theme.palette
. And primary, secondary buttons have own classes like MuiButton-outlinedPrimary
based on variant value.
When i override Button color property component with my own palette colors MuiButton-outlinedPrimary
and etc. classes disappear. Therefore hover background-color styles disappear,
and I don’t know how to add suitable background-color with opacity.
Perhaps the solution is to add a hover property to buttons, but how to convert HEX to RGBA like rgba(83, 109, 254, 0.08)
Differences between default Button and custom, as you can see hover color is different
Custom button
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
CSS Buttons - W3Schools
.button · background-color: #4CAF50; /* Green */ border: none; color: white; padding: 15px 32px; text-align: center; text-decoration: none; display: inline-block ...
Read more >Bootstrap button – 9 demos of custom color, size, dropdown ...
This is almost the same example as above except I used a few CSS 3 properties. While this time I used btn-danger class...
Read more >CSS Button Style – Hover, Color, and Background
To change the background color of the button, use the CSS background-color property and give it a value of a color of your...
Read more >ion-button - Ionic Framework
CSS Custom Properties ; --color-focused, Text color of the button when focused with the tab key ; --color-hover, Text color of the button...
Read more >How to Change the Button Color in HTML - wikiHow
1. Type and tags. The body is where the visible elements of a web page are placed using HTML. 2. Type style= after...
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
If I understand this correctly it’s basically a request for dynamic colors in buttons. More or less a dupe of https://github.com/mui-org/material-ui/issues/13875
In the code you’re only overwriting the default style. Have a look at https://github.com/mui-org/material-ui/blob/master/packages/material-ui/src/Button/Button.js#L21 if you want to check how it’s done in core.
A for now simpler variant would be to wrap the button with a custom theme provider, providing the palette you want to use inside your button.
@sakulstra Thanks.