Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/Sambego/storybook-styles
- Owner: Sambego
- License: mit
- Created: 2017-10-10T17:48:19.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2017-10-11T08:43:00.000Z (about 7 years ago)
- Last Synced: 2024-10-31T17:17:16.486Z (20 days ago)
- Language: JavaScript
- Homepage:
- Size: 249 KB
- Stars: 24
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Authors: AUTHORS
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.