How to remove default styles in Storybook Docs
See original GitHub issueSupport request summary
I’m using Storybook and the Docs Addon to create a living design system.
Storybook Docs comes with a set of default styles, like Nunito Sans as the typeface, and a bunch of other typographic styles. So each <Preview> tag injects these styles, and our components don’t reflect the spec from our design team.
I’m trying to create preview that have no default styles. Essentially removing the styles that come with Storybook Docs inside the preview box. All I want to inject are styles related to our design system.
Current setup:
- I’ve written some custom styles at
build/styles.css - Inside
preview-head.html, I import styles using<link rel="stylesheet" href="./style.css" /> - When running storybook, I reference the static folder to access styles
start-storybook -p 6006 -s ./build
When I run Storybook, I’m seeing my custom styles AND the default Storybook styles.
Storybook version
- @storybook/react 5.3.9
- @storybook/addon-docs 5.3.9
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:5 (4 by maintainers)
Top Results From Across the Web
How to remove default styles in storybook - Stack Overflow
First off, you can't remove ALL of the styles of Storybook. ... Those styles in your screenshot are only applying to the docs...
Read more >DocsPage - Storybook - JS.ORG
When you install Storybook Docs, DocsPage is the zero-config default documentation that all stories get out of the box. It aggregates your stories, ......
Read more >Theming - Storybook
To style these elements, insert style tags into: For Storybook's UI, use .storybook/manager-head.html; For Storybook Docs, use .storybook/preview-head ...
Read more >Styling and CSS - Storybook
Storybook is a frontend workshop for building UI components and pages in isolation. Thousands of teams use it for UI development, testing, and...
Read more >Controls - Storybook - JS.ORG
Thousands of teams use it for UI development, testing, and documentation. ... If you have stories in the older pre-Storybook 6 style, check...
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
Is there actually a different way to do this? When you use a
<Story/>, you remove the ability to have Documentation-only MDX files. It would be awesome to strip the default styles from<Preview/>with a prop or something similar.@tsnolan23 good idea, and maybe something that’s come up elsewhere. Want to open up a separate feature request issue for this? I think it might be an easy fix to just copy the styling reset code out of
Storyand add it toPreview.