How to remove default styles in Storybook Docs

See original GitHub issue

Support 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

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

5reactions
tsnolan23commented, Mar 24, 2020

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.

1reaction
shilmancommented, Mar 25, 2020

@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 Story and add it to Preview.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found