storybook/docs/api/main-config/main-config-preview-annotations.mdx
Charles de Dreuille 2d32ceaba6 API Main config
2024-06-17 18:56:10 +01:00

28 lines
848 B
Plaintext

---
title: 'previewAnnotations'
sidebar:
order: 15
title: previewAnnotations
---
Parent: [main.js|ts configuration](./main-config.mdx)
Type: `string[] | ((config: string[], options: Options) => string[] | Promise<string[]>)`
Add additional scripts to run in the story preview.
<Callout variant="info" icon="💡">
Mostly used by [frameworks](../../contribute/framework.mdx#previewjs-example). Storybook users and [addon authors](../../addons/writing-presets.mdx) should add scripts to [`preview.js`](../../configure/index.mdx#configure-story-rendering) instead.
</Callout>
```ts
// @storybook/nextjs framework's src/preset.ts
import type { StorybookConfig } from './types';
export const previewAnnotations: StorybookConfig['previewAnnotations'] = (entry = []) => [
...entry,
require.resolve('@storybook/nextjs/preview.js'),
];
```