Importing global style of styled-component for all stories
See original GitHub issueThis is not really a bug but I’m stuck importing global style of styled-component, for now I have to include it in every single of my story
import { storiesOf } from '@storybook/react'
import { withKnobs } from '@storybook/addon-knobs'
import MyComponent from '../components/MyComponent'
import { GlobalStyle } from '../pages/layout'
const stories = storiesOf('MyComponent', module)
stories.addDecorator(withKnobs)
stories.add(
'My Component',
() => (
<>
<GlobalStyle />
<MyComponent />
</>
)
)
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (1 by maintainers)
Top Results From Across the Web
Default styles in Storybook with Styled Components
My global styles are created using styled-reboot, an addition to Styled ... import { createGlobalStyle } from "styled-components"; import ...
Read more >Import Global Stylesheets for all Stories in preview.js
This is a great way to get general CSS into all stories and useful practice for adding resets, fonts, and globally shared stylesheets....
Read more >Storybook: how to import styles for individual stories
My components are styled by the <style> block in the bottom of each .vue file. There are also some global CSS (Sass) files...
Read more >6 Ways To Configure Global Styles for Storybook | by Jennifer Fu
We can verify that the global style changes have been applied to every story. However, the style change does not apply to any...
Read more >Build UI components - Storybook Tutorials
+ import React from 'react'; + import { GlobalStyle } from '../src/shared/global'; /* * Global decorator to apply the styles to all stories...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @eldyvoon,
The best approach here is to add a global decorator
With Storybook 6x I loaded my global style like this;