storybook/docs/api/main-config/main-config-preview-body.mdx
2024-07-09 23:44:05 +01:00

27 lines
803 B
Plaintext

---
title: 'previewBody'
sidebar:
order: 16
title: previewBody
---
Parent: [main.js|ts configuration](./main-config.mdx)
Type: `(body: string) => string`
Programmatically adjust the [preview `<body>`](../../configure/story-rendering.mdx#adding-to-body) of your Storybook. Most often used by [addon authors](../../addons/writing-presets.mdx#ui-configuration).
<Callout variant="info" icon="💡">
If you don't need to programmatically adjust the preview body, you can add scripts and styles to [`preview-body.html`](../../configure/story-rendering.mdx#adding-to-body) instead.
</Callout>
For example, you can conditionally add scripts or styles, depending on the environment:
{/* prettier-ignore-start */}
<CodeSnippets path="main-config-preview-body.md" />
{/* prettier-ignore-end */}