Skip to content

addonVis

addonVis() is the default export of storybook-addon-vis. It returns a preview addon for definePreview().

.storybook/preview.ts
import addonVis from 'storybook-addon-vis'
import { definePreview } from '@storybook/your-framework/node'
export default definePreview({
addons: [addonVis({ auto: true })],
})
function addonVis(options?: SetupVisOptions<{ tags: string[] }>): PreviewAddon

The default is { auto: false }.

The options are those of vis.setup: auto (a boolean, a function, or an object of themes) and createMissingBaseline.

  • With auto: true, it adds the snapshot tag to every story.
  • In a Vitest browser run, beforeAll prepares the matcher and turns automatic snapshot options on.
  • afterEach takes the snapshot, once per theme when auto is an object.
  • It includes visAnnotations.

It also registers toMatchImageSnapshot on expect when the module loads, so the matcher exists in Storybook dev mode.

See the CSF Next guide.