TeslaXba
TeslaXba

Reputation: 357

Storybook - How to import a component from a external project using styled-components (React + TS)?

I am trying to import a component from an external project into my storybook. I imported it, for example, a custom Button, but the style is not being rendered, it shows only the default html button style and not my styled-component.

I also tried importing it in .storybook/preview.js like the other scss files and bootstrap library, but still, the styled-components style is not being rendered.

import Button from "..filelocation"

Upvotes: 1

Views: 2619

Answers (1)

beeftosino
beeftosino

Reputation: 300

For storybook you can make a global (storybook folder) css style by making a .storybook/preview-head.html file and adding your css there via css. source: https://storybook.js.org/docs/react/configure/styling-and-css

However you can also just add a styles.css inside your storybook component and call it with import './styles.css';

Upvotes: 1

Related Questions