question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Global layout parameter isn't applied to DocsPage canvas

See original GitHub issue

Describe the bug

When I add a global layout parameter (e.g. layout: 'fullscreen') in preview.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:

<Canvas>
  <Story name="storyname" parameters={{ layout: 'fullscreen' }}>

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® Core™ 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

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:7
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
shilmancommented, Oct 27, 2022

@tgelu In the original issue description @robbertkl mentioned that it works if he adds a layout parameter to the Story block, so I added has workaround label. I did not verify the behavior. Though re-reading the issue I doubt that actually works. Removing the label, but please let me know if you find a workaround!

0reactions
tgelucommented, Oct 27, 2022

This seems to be tagged as “has workaround”. What is the workaround @shilman ? 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

DocsPage - Storybook - JS.ORG
It aggregates your stories, text descriptions, docgen comments, args tables, and code examples into a single page for each component. The best practice...
Read more >
Compare DocsPage and MDX syntax in Storybook with example
This post compares the DocsPage and MDX syntax to write story of your UI components using Storybook. We will continue with the Card...
Read more >
Documenting design systems with Storybook Docs
import { Canvas, Meta, Story } from '@storybook/addon-docs/blocks' ... for applying something like margin: '20px' to all stories; parameters ...
Read more >
storybook/addon-docs - npm
Storybook Docs transforms your Storybook stories into world-class component documentation. DocsPage. Out of the box, all your stories get a ...
Read more >
Editor Page Canvas | 8base Docs
The Page Canvas area gets used to build your application when working inside ... about Layouts and Views in the Components in their...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found