themesberg / flowbite-react

Official React components built for Flowbite and Tailwind CSS
https://flowbite-react.com
MIT License
1.9k stars 425 forks source link

Use custom colors from tailwind.config.js in `color` attribute #62

Closed tulup-conner closed 2 years ago

tulup-conner commented 2 years ago

Is your feature request related to a problem? Please describe. I can't really migrate to flowbite-react without the ability to use custom colors I defined in tailwind.config.js. At the very least, I need an escape hatch in each component (className).

Describe the solution you'd like I would like to be able to define a color, primary in tailwind.config.js, then use that color in flowbite-react components like so:

<Button color="primary">Hi</Button>

Describe alternatives you've considered As long as each component provides the ability to directly specify a className, I can do this myself.

Additional context n/a

rluders commented 2 years ago

This is something that I want to introduce with this #61: the ability to theme supporting. I'm not sure if there is some workaround... @bacali95 any idea?

bacali95 commented 2 years ago

Hello there, no there is no workaround for this for now.

tulup-conner commented 2 years ago

If that's the case, I would like to add classNames to Alert, Badge, Button as an escape hatch so users can apply colors themselves.

tulup-conner commented 2 years ago

Related issue: #79

tulup-conner commented 2 years ago

This should be resolved once theme support is added #92. I'll retroactively add an example of how to accomplish the above example.

tulup-conner commented 2 years ago

With #151 we have implemented the first component with theme support that specifically includes the ability to add your own colors.

I will be adding this to buttons this week and will close this with that PR.