Skip to content

Commit

Permalink
Merge pull request #23 from ritz078/documentation
Browse files Browse the repository at this point in the history
added documentation for APIs
  • Loading branch information
Muhammed Thanish authored Aug 11, 2016
2 parents 3c34253 + 9c95860 commit aa283c0
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,54 @@ Then you'll get a UI like this:

> **See the [example](/example) app for a complete example.**
## API

### .setOptions([option])

```js
//-------------
handleAPI(api) {
api.setOptions{
name: 'My Component', // change the name displayed in the left top portion
url: 'https://github.com/user/my-component' // change its URL
}
}
```

## .setStories([stories])

This API is used to pass the`kind` and `stories` list to storybook-ui.

```js
handleAPI(api) {
api.setStories([
{
kind: 'Component 1',
stories: ['State 1', 'State 2']
},

{
kind: 'Component 2',
stories: ['State a', 'State b']
}
]
}
```
## .onStory()
You can use to listen to the story change and update the preview.
```js
handleAPI(api) {
api.onStory((kind, story) => {
this.globalState.emit('change', kind, story);
});
}
```
## Hacking Guide
If you like to add features to the Storybook UI or fix bugs, this is the guide you need to follow.
Expand Down

0 comments on commit aa283c0

Please sign in to comment.