mirror of
https://github.com/storybookjs/storybook.git
synced 2025-03-28 05:10:17 +08:00
# Conflicts: # MIGRATION.md # addons/backgrounds/package.json # addons/events/package.json # addons/info/package.json # addons/info/src/__snapshots__/index.test.js.snap # addons/jest/package.json # addons/knobs/package.json # addons/links/package.json # addons/notes/package.json # addons/options/package.json # addons/storyshots/storyshots-core/package.json # addons/storyshots/storyshots-puppeteer/package.json # addons/storysource/package.json # addons/viewport/package.json # app/angular/package.json # app/html/package.json # app/marko/package.json # app/mithril/package.json # app/polymer/package.json # app/react/package.json # app/vue/package.json # examples/angular-cli/package.json # examples/cra-kitchen-sink/package.json # examples/html-kitchen-sink/package.json # examples/marko-cli/package.json # examples/mithril-kitchen-sink/package.json # examples/official-storybook/package.json # examples/official-storybook/stories/__snapshots__/addon-info.stories.storyshot # examples/official-storybook/stories/__snapshots__/other-dirname.stories.storyshot # examples/polymer-cli/package.json # examples/vue-kitchen-sink/package.json # jest.config.js # lib/cli/package.json # lib/cli/test/snapshots/angular-cli/package.json # lib/cli/test/snapshots/marko/package.json # lib/cli/test/snapshots/meteor/package.json # lib/cli/test/snapshots/mithril/package.json # lib/cli/test/snapshots/polymer/package.json # lib/cli/test/snapshots/react/package.json # lib/cli/test/snapshots/react_project/package.json # lib/cli/test/snapshots/react_scripts/package.json # lib/cli/test/snapshots/sfc_vue/package.json # lib/cli/test/snapshots/update_package_organisations/package.json # lib/cli/test/snapshots/vue/package.json # lib/cli/test/snapshots/webpack_react/package.json # lib/codemod/package.json # lib/components/src/layout/__snapshots__/index.stories.storyshot # lib/core/package.json # lib/core/src/server/config/webpack.config.prod.js # package.json # yarn.lock
Storybook Addon Notes
Storybook Addon Notes allows you to write notes (text or HTML) for your stories in Storybook.
Getting Started
NOTE: Documentation on master branch is for alpha version, stable release is on release/3.4
yarn add -D @storybook/addon-notes
Then create a file called addons.js
in your storybook config.
Add following content to it:
import '@storybook/addon-notes/register';
Then add the withNotes
decorator to all stories in your config.js
:
// Import from @storybook/X where X is your framework
import { configure, addDecorator } from '@storybook/react';
import { withNotes } from '@storybook/addon-notes';
addDecorator(withNotes);
You can use the notes
parameter to add a note to each story:
import { storiesOf } from '@storybook/react';
import Component from './Component';
storiesOf('Component', module)
.add('with some emoji', () => <Component />, { notes: 'A very simple component' });
Using Markdown
To use markdown in your notes, either through import or inline, simply put it in the markdown
property of your note.
import { storiesOf } from '@storybook/react';
import Component from './Component';
import someMarkdownText from './someMarkdownText.md';
storiesOf('Component', module).add(
'With Markdown',
() => <Component />,
{ notes: { markdown: someMarkdownText } }
);