-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Global layout parameter isn't applied to DocsPage canvas #12135
Comments
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks! |
Hi, is there any workaround for this issue ? |
Same problem, but the workaround doesn't seems to work if you use the CSF. |
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks! |
Hi! Bumping this. I'm setting the layout parameter to It's not very clear what parameters are available for the various tools/addons in the documentation. |
Hi! Same problem -- I would like to set all my docPage stories to have Would love anyone suggestions... |
perhaps a prop on the docs parameter @shilman ? |
This seems to be tagged as "has workaround". What is the workaround @shilman ? :) |
@tgelu In the original issue description @robbertkl mentioned that it works if he adds a layout parameter to the |
It still doesn't work in Storybook 7 Beta 31. @shilman I found one workaround for this issue by referencing Stories within an MDX file instead of embedding them directly. Working example of a Web-component story (should work with other frameworks like React too)
import { Canvas, Meta, Story } from '@storybook/blocks'
import * as Stories from './my-component.stories'
<Meta of={ Stories } />
# My component
Some documentation
<Canvas>
<Story of={ Stories.ExampleStory } />
</Canvas>
import { html } from 'lit/static-html.js'
export default {
title: 'Components/MyComponent,
parameters: {
layout: 'fullscreen'
}
}
export const ExampleStory = {
render: () => html`<my-component title="Hello World"></my-component>`
} The key here is that in the MDX file you reference the Meta definition of the TSX file by doing In the default export of the TSX file, |
@rschaufler what you shared is the recommended way of using CSF+MDX in 7.0 and beyond. Thank you for following up! @tmeasday @JReinhold is this something we can fix as we stabilize the changes to the story block? |
As a matter of fact I was working on this exact thing yesterday. I'm not sure I understand this issue completely, but the next iteration of the Canvas doc block will respect
It will take the parameters from the story, which should include whatever is defined globally in |
Olé!! I just released https://github.com/storybookjs/storybook/releases/tag/v7.0.0-beta.33 containing PR #20723 that references this issue. Upgrade today to the
|
Looks like it still doesn't work.
or
Temporarily, I found this workaround.
Which is quite sad but it's working. |
@cr0cK can you open a new issue with a minimal reproduction showcasing the issue? |
Describe the bug
When I add a global layout parameter (e.g.
layout: 'fullscreen'
) inpreview.js
it gets applied to the Canvas tab of all stories. However, it does not get applied to the stories / Canvas element on my MDX DocsPage. I would still need to set this manually for it to work:To Reproduce
Add a global layout parameter to
.storybook/preview.js
and check out a docs page with a story wrapped in a canvas.Expected behavior
I expected the docs page story to apply the same global parameters and not need to manually add the parameters to every story.
System:
Environment Info:
System:
OS: macOS 10.15.5
CPU: (4) x64 Intel(R) Core(TM) i5-6267U CPU @ 2.90GHz
Binaries:
Node: 14.8.0 - /usr/local/bin/node
Yarn: 1.22.4 - /usr/local/bin/yarn
npm: 6.14.7 - /usr/local/bin/npm
Browsers:
Chrome: 84.0.4147.125
Firefox: 75.0
Safari: 13.1.1
npmPackages:
@storybook/addon-controls: ^6.0.13 => 6.0.13
@storybook/addon-docs: ^6.0.13 => 6.0.13
@storybook/react: ^6.0.13 => 6.0.13
The text was updated successfully, but these errors were encountered: