Can't use custom color from theme in Button component
See original GitHub issuetrying to use custom color from theme object in button component
That’s not working
<Button variantColor="newColor" size="md"> Button </Button>
But when using same color in Box component , it’s working:
<Box my={2} bg="newColor"> some box here </Box>
here is the example: https://codesandbox.io/s/vibrant-bush-76581
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (2 by maintainers)
Top Results From Across the Web
How to use colors from my Material UI theme in button?
I have a theme, but I cannot use a color from the theme within button. It's locked to a few different colors and...
Read more >Changing colors - Squarespace Help Center
In any palette, you can use the Palette editor to customize each color in the palette. Change section colors. Your color palette generates ......
Read more >Color Mode - Chakra UI
Color Mode. Chakra UI comes with built-in support for managing color mode in your apps. By default, most of Chakra's components are dark...
Read more >Change how your site looks - Sites Help - Google Support
If you're using a custom theme · Point to a section on the page. Then, at the left, click Background Color . ·...
Read more >Angular Material Theming System - Complete Guide
We will then add a custom theme in it and understand some important ... can also customize color and typography styles for components...
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 FreeTop 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
Top GitHub Comments
Hi @ruslan-mystore,
I should have made it clearer in the docs but to use to
variantColor
with a custom color, you need to create a color object of this shape:The reason is that
Button
has interactive styles (hover, action, disabled) and we pick color values from the object to make it work out of the box.Use a tool like https://colorbox.io or https://smart-swatch.netlify.com to generate this quickly.
In the future, we’ll make this more declarative so you’ll be in control of this behavior.
@segunadebayo , I’ve followed what you’ve said, but still can’t seem to fix the warning and can’t use the color.
theme.tsx
looks like this:And I’m trying to use the
grey.900
color in this button