Add-ons in Storybook
Learn how to use add-ons with Storybook to further enhance your Docs.
We'll cover the following...
Enhancing stories with add-ons
The magic of Storybook is its extensibility in the form of assorted add-ons. There are abundant options for making your documentation richer through these handy plugins.
- 
Let’s start with the Actions add-on. This will add a panel to the bottom of the page for reporting events. We’ll use it to display onIndexChangeevents. Start by installing the add-on from npm:$ npm install --save-dev @storybook/addon-actions@4.1.11 + @storybook/addon-actions@4.1.11
- 
Then create a new file called .storybook/addons.jsand add this line to register the new add-on:// .storybook/addons.js import '@storybook/addon-actions/register';The webpack server watches existing files for updates, but won’t recognize new files, so you’ll need to restart it before continuing. 
- 
Now add a bit of code to the Carouselstory to tell the add-on to listen foronIndexChange:
import React from 'react';import { storiesOf } from '@storybook/react';import { action } from '@storybook/addon-actions';import Carousel from '../src/Carousel';import slides from '../example/slides';storiesOf('Carousel', module).add('default', () => (<Carousel slides={slides} onIndexChange={action('onIndexChange')} />));
With that change, you should see a new ...