mirror of
https://github.com/storybookjs/storybook.git
synced 2025-03-21 05:02:39 +08:00
48 lines
1.8 KiB
Markdown
48 lines
1.8 KiB
Markdown
# Storybook Addon Notes
|
|
|
|
[](https://greenkeeper.io/)
|
|
[](https://travis-ci.org/storybooks/storybook)
|
|
[](https://www.codefactor.io/repository/github/storybooks/storybook)
|
|
[](https://snyk.io/test/github/storybooks/storybook/8f36abfd6697e58cd76df3526b52e4b9dc894847)
|
|
[](https://bettercodehub.com/results/storybooks/storybook) [](https://codecov.io/gh/storybooks/storybook)
|
|
[](https://storybooks-slackin.herokuapp.com/)
|
|
|
|
Storybook Addon Notes allows you to write notes for your stories in [Storybook](https://storybook.js.org).
|
|
|
|
This addon works with Storybook for:
|
|
[React](https://github.com/storybooks/storybook/tree/master/app/react).
|
|
|
|

|
|
|
|
### Getting Started
|
|
|
|
```sh
|
|
npm i --save-dev @storybook/addon-notes
|
|
```
|
|
|
|
Then create a file called `addons.js` in your storybook config.
|
|
|
|
Add following content to it:
|
|
|
|
```js
|
|
import '@storybook/addon-notes/register';
|
|
```
|
|
|
|
Then write your stories like this:
|
|
|
|
```js
|
|
import React from 'react';
|
|
|
|
import { storiesOf } from '@storybook/react';
|
|
import { WithNotes } from '@storybook/addon-notes';
|
|
|
|
import Component from './Component';
|
|
|
|
storiesOf('Component', module)
|
|
.add('with some emoji', () => (
|
|
<WithNotes notes={'A very simple component'}>
|
|
<Component></Component>
|
|
</WithNotes>
|
|
));
|
|
```
|