storybook-decorators
TypeScript icon, indicating that this package has built-in type declarations

0.3.2 • Public • Published

storybook-decorators

Latest version in npm

The project is in initial development. More decorators and documentation will be added.

Storybook-decorators provides common Storybook decorators for enhancing the prototyping experience. Decorators are independent of each other meaning it is possible to use only a subset of the decorators provided. The library also provides a compose function for composing decorators in natural order.

Usage

First, add storybook-decorators add a dependency to your project:

$ npm install --save --dev storybook-decorators

In your story files, import and use the decorators you want:

import {storiesOf} from "@storybook/react";
import {background, centered, compose} from "storybook-decorators";
 
// Using compose is not required, but it flips the application order for the decorators and thus is more natural to read.
const decorate = compose(background, centered);
 
storiesOf("SomeComponent", module)
  .addDecorators(decorate)
  .add("Story 1", () => <div>Story 1</div>);

License

MIT

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.3.22latest

Version History

VersionDownloads (Last 7 Days)Published
0.3.22
0.3.12
0.3.01
0.3.0-beta.31
0.3.0-beta.21
0.3.0-beta.11
0.2.31
0.1.01
0.0.11

Package Sidebar

Install

npm i storybook-decorators

Weekly Downloads

11

Version

0.3.2

License

MIT

Unpacked Size

12.7 kB

Total Files

18

Last publish

Collaborators

  • strax