Sorry, but you either have no stories or none are selected somehow.
If the problem persists, check the browser console, or the terminal you've run Storybook from.
I used CSS variables to style each component with a fallback value. What this means is that you can directly use the
component without any theming if you like the blue theme that I followed. Or you can choose to override them by
setting values to each of these variable in :root
selector.
Example
Further, these variables can also be overriden at a block level.
Example
You can also style each component by passing a style
prop or if you like you can set a className
and then override
style to these class. This should work fine for small tweaks like overriding width
of the component. But if you want
to do it for a lot of styles, your code quality may take a hit. For such cases refer our
extending styles guide.
CodeSandbox
URL: https://codesandbox.io/s/theming-etdbq?file=/src/ItemCard.js
It showcases following features:
- How easy it is to apply custom theme to the components at various levels.
- Each component plays nicely with one another and can be customized easily.
- The DOM is also comparitively clean as only required nodes are mounted.
Variable Name | Default Value |
---|---|
--primary | #2283d2 |
--primary-light | #64baff |
--primary-lighter | #cfe9ff |
--backdrop-color | #2681da80 |
--info | #2283d2 |
--info-light | #64baff |
--success | #22d295 |
--success-light | #80eac6 |
--warning | #cc9500 |
--warning-light | #ffba00 |
--error | #d63b3b |
--error-light | #f1a5a5 |
--border-color | #555555 |
--toast | #5f5f5f |
--disabled | #777 |
--tooltip-color | rgba(0,0,0,0.5) |
--disabled-border | #aaa |
--light-grey | #ccc |
--border-light-color | #eeeeee |
--disabled-background | #fafafa |
--background | #ffffff |
Variable Name | Default Value |
---|---|
--shadow | 0px 1px 3px 0px rgba(0,0,0,0.1), 0px 1px 2px 0px rgba(0,0,0,0.06) |
--hover-shadow | 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06) |
--modal-shadow | 0px 8px 17px 2px rgba(0,0,0,0.14), 0px 3px 14px 2px rgba(0,0,0,0.12), 0px 5px 5px -3px rgba(0,0,0,0.2) |