Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/z4o4z/storybook-addon-events
This Storybook addon allows you to add events for your stories.
https://github.com/z4o4z/storybook-addon-events
events react storybook
Last synced: about 2 months ago
JSON representation
This Storybook addon allows you to add events for your stories.
- Host: GitHub
- URL: https://github.com/z4o4z/storybook-addon-events
- Owner: z4o4z
- License: mit
- Created: 2017-04-13T12:41:02.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-06-26T10:13:58.000Z (over 2 years ago)
- Last Synced: 2024-10-08T12:36:46.078Z (3 months ago)
- Topics: events, react, storybook
- Language: JavaScript
- Homepage:
- Size: 479 KB
- Stars: 4
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Storybook Addon Events
This [storybook](https://storybooks.js.org) ([source](https://github.com/storybooks/storybook)) addon allows you to add events for your stories.
![Storybook Addon Events Example](docs/demo1.png)
[Storybook Addon Events Live Demo](https://z4o4z.github.io/storybook-addon-events/index.html)### Getting Started
**note: addons require @kadira/storybook 2.x or greater*```sh
npm i --save-dev @z4o4z/storybook-addon-events
```Then create a file called `addons.js` in your storybook config.
Add following content to it:
```js
import '@kadira/storybook/addons';
import '@z4o4z/storybook-addon-events/register';
```Then write your stories like this:
```js
import React from 'react';
import EventEmiter from 'event-emiter';
import { storiesOf } from '@kadira/storybook';
import WithEvents from '@z4o4z/storybook-addon-events';import Logger from './Logger';
import * as EVENTS from './events';const emiter = new EventEmiter();
const emit = emiter.emit.bind(emiter);storiesOf('WithEvents', module)
.addDecorator(getStory => (
{getStory()}
))
.add('Logger', () => );
```