Skip to content

Latest commit

 

History

History
32 lines (24 loc) · 883 Bytes

README.md

File metadata and controls

32 lines (24 loc) · 883 Bytes

Storybook styles

This storybook decorator allows you to add custom styles to the storybook preview panel.

Screenshot of a styles storybook preview

Getting Started

npm install --save @sambego/storybook-styles

Then write your stories like this:

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", () => <button>Click me</button>);

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