feat(theme): adding theme prop to components #566
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The following components can now be customized with a
theme={}
attribute inline:Please note that components you do NOT see on this list can STILL be customized by simply adding a
className
. These components do not have any default classes or complex structure and thus don't need a theme at all.This behavior is still considered a work in progress, and in general, we are still experimenting with how to provide users with the best way to customize components. You can expect that this API might change at any time. We also need your feedback on how to improve it.
Related to #465
Type of change
Breaking changes
We are also finishing the process of converting components to a new theme structure, so you can expect the themes of almost all components to change in expected behavior.
Now, components that can have children will have a
root
section which contains the classes that apply only to the parent component. That's kind of a complicated sentence, so here's an example.<Accordion>
s can contain any number of<Accordion.Title>
s and<Accordion.Content>
s as children. The new accordion theme looks like:Previously, the accordion theme was:
We've just moved the loose classes - for
<Accordion>
s, that'saccordion.base
andaccordion.flush
- intoroot
to make the theme more clearly reflect the relationship betweenflowbite-react
components.How Has This Been Tested?
yarn test
yarn start
,yarn start:storybook
We should consider adding tests using the
theme={}
attribute in every component where it is allowed. The specific benefit of that is to ensure that the expected theme format actually works.Checklist: