themesberg / flowbite-react

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

DarkThemeToggle component don’t support custom component icon #1143

Closed oscles closed 9 months ago

oscles commented 9 months ago

Summary

It would be nice if the DarkThemeToggle component could receive custom icon components and not just a string for the icon since when using typescript the linter throws an error because the props don't satisfy the interface.

image

image

Solution

A possible solution could be the following: image

SutuSebastian commented 9 months ago

It seems like the string type was wrong in the first place.

This needs fixing, thanks for reporting it! 🔥

SutuSebastian commented 9 months ago

Also, u can create ur own dark theme component using the exposed useThemeMode() function, which DarkThemeToggle component uses under the hood.

oscles commented 9 months ago

Did they release a new version of the library to fix the bug?

SutuSebastian commented 9 months ago

V0.7.0 is coming soon, containing this fix as well.