-
-
Notifications
You must be signed in to change notification settings - Fork 476
Description
Is your feature request related to a problem? Please describe.
Today we do have the [flowbite-react theme[(https://flowbite-react.com/theme) that can be used to customize the components and also direct access to component className.
The problem with this approach is that using the className you can only apply custom classes to the root element component (normally the one with theme.base), and you need to sometimes use !important tag to overwrite some existing styles. This is OK for small customizations, or if you don't mind writing some CSS.
Note
You could add to your component usingclassNamea custom class as.my-custom-classand overwrite all the component styles with CSS.
Also, the theme support is great, and it helps to keep the UI consistent, but it also leads you to not be able to create multiple component styles that can be reused. In this case, with the theme component, you can customize every single item inside the component, access its defined theme property styles, and even extend some of them. But, this style will be shared between all components, and today you can't apply custom themes per component, which is painful.
Describe the solution you'd like
Allow the user to create custom component themes that can be individually applied and fully overwrite the main flowbite-react theme for one specific component.
Example of usage:
const AccordionCustomTheme = {
base: 'divide-y divide-gray-200 border-gray-200 dark:divide-gray-700 dark:border-gray-700',
content: {
base: 'py-5 px-5 last:rounded-b-lg dark:bg-gray-900 first:rounded-t-lg',
},
flush: {
off: 'rounded-lg border',
on: 'border-b',
},
title: {
arrow: {
base: 'h-6 w-6 shrink-0',
open: {
off: '',
on: 'rotate-180',
},
},
base: 'flex w-full items-center justify-between first:rounded-t-lg last:rounded-b-lg py-5 px-5 text-left font-medium text-gray-500 dark:text-gray-400',
flush: {
off: 'hover:bg-gray-100 focus:ring-4 focus:ring-gray-200 dark:hover:bg-gray-800 dark:focus:ring-gray-800',
on: '!bg-transparent dark:!bg-transparent',
},
heading: '',
open: {
off: '',
on: 'text-gray-900 bg-gray-100 dark:bg-gray-800 dark:text-white',
},
},
};
// ...
return (
<Accordion theme={AccordionCustomTheme}>
<Accordion.Panel>
<Accordion.Title>What is Flowbite?</Accordion.Title>
<Accordion.Content>
<p className="mb-2 text-gray-500 dark:text-gray-400">
Flowbite is an open-source library of interactive components built on top of Tailwind CSS including buttons,
dropdowns, modals, navbars, and more.
</p>
<p className="text-gray-500 dark:text-gray-400">
Check out this guide to learn how to{' '}
<a
href="https://flowbite.com/docs/getting-started/introduction/"
className="text-blue-600 hover:underline dark:text-blue-500"
>
get started
</a>{' '}
and start developing websites even faster with components on top of Tailwind CSS.
</p>
</Accordion.Content>
</Accordion.Panel>
</Accordion>
)Describe alternatives you've considered
None.
Additional context
None.
Related issues
- AccordionTheme (Feat/theming #450)
- AlertTheme (Feat/theming #450)
- AvatarTheme (Feat/theming #450)
- AvatarGroupTheme (Feat/theming #450)
- BadgeTheme (Feat/theming #450)
- BreadcrumbTheme (Feat/theming #450)
- ButtonTheme (Feat/theming #450)
- ButtonGroupTheme (Feat/theming #450)
- CardTheme (Feat/theming #450)
- CarouselTheme (Feat/theming #450)
- DarkThemeToggleTheme (Feat/theming #450)
- DropdownTheme (Feat/theming #450)
- FloatingTheme (Feat/theming #450)
- FooterTheme (Feat/theming #450)
- HelperTextTheme (Feat/theming #450)
- ListGroupTheme (Feat/theming #450)
- ModalTheme (Feat/theming #450)
- NavbarTheme (Feat/theming #450)
- PaginationTheme (Feat/theming #450)
- ProgressTheme (Feat/theming #450)
- RatingTheme (Feat/theming #450)
- SidebarTheme (Feat/theming #450)
- SpinnerTheme (Feat/theming #450)
- TabTheme (Feat/theming #450)
- ToastTheme (Feat/theming #450)
- TooltipTheme (Feat/theming #450)
- Theme Interface: TableTheme #452
- Theme Interface: ToastTheme #453
- Theme Interface: TimelineTheme #454
- Theme Interface: CheckboxTheme #455
- Theme Interface: FileInputTheme #456
- Theme Interface: LabelTheme #457
- Theme Interface: RadioTheme #458
- Theme Interface: SelectTheme #459
- Theme Interface: TextInputTheme #460
- Theme Interface: TextAreaTheme #461
- Theme Interface: ToggleSwitchTheme #462
- Allow customize components with
theme={}props #465