Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/Sambego/storybook-styles

Add custom styles to the storybook preview panel
https://github.com/Sambego/storybook-styles

Last synced: 4 days ago
JSON representation

Add custom styles to the storybook preview panel

Awesome Lists containing this project

README

        

# Storybook styles

This [storybook](https://storybook.js.org/) decorator allows you to add custom styles to the storybook preview panel.

![Screenshot of a styles storybook preview](./storybook-styles.png)

### Getting Started

```sh
npm install --save @sambego/storybook-styles
```

Then write your stories like this:

```js
import React from 'react';
import { storiesOf } from "@storybook/react";
import styles from "@sambego/storybook-styles";

storiesOf("Button", module)
.addDecorator(styles({
fontFamily: 'Helvetica, Arial, sans-serif',
background: '#e1ecfa',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
height: '500px',
}))
.add("with text", () => Click me);
```

The style decorator accepts a JavaScript object with camelCased style properties which will be applied around the content of the preview area.