Storybook: How to remove preview body padding in SB 6.0?

Created on 18 Aug 2020  路  6Comments  路  Source: storybookjs/storybook

This does not work (fixed element.style seems to be "padding: 1 rem"):

<!-- .storybook/preview-body.html --> <style> body { padding: 0; background-color: #005cc5; } </style>

Any ideas?

core question / support

Most helpful comment

try the layout: 'fullscreen' story parameter

All 6 comments

try the layout: 'fullscreen' story parameter

Same issue here, setting isFullscreen: true as per https://storybook.js.org/docs/react/configure/features-and-behavior doesn't fix it.

Must admit I haven't dug far but SB is adding style="margin: 0px; padding: 1rem; display: block; justify-content: initial; align-items: initial; min-height: initial;" to body for some reason.

@coconewty isFullscreen: true isn't the same thing as layout: 'fullscreen'. in .storybook/preview.js:

export const parameters = { layout: 'fullscreen' }

Works great. Thank you.

Thanks @shilman I missed this.

FYI of anyone else hunting for this, it's here... https://storybook.js.org/docs/react/configure/story-layout

Thanks @shilman I missed this.

FYI of anyone else hunting for this, it's here... https://storybook.js.org/docs/react/configure/story-layout

Adding some google search keywords;

How to remove default canvas margin in Storybook v6

Was this page helpful?
0 / 5 - 0 ratings