-
-
Notifications
You must be signed in to change notification settings - Fork 9.1k
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
Addon-docs: Add parameter to show code by default #14729
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great @frassinier, thank you! Made a couple small changes before merging 😉
Hi :D I've just tested this in the new alpha release, and it seems it works when set:
but it does not work when set:
|
This PR was for Canvas, not the Story actually, In MDX, at the story level, we still need to use
|
@frassinier thank you! It seems I can also use "isExpanded" on a named exported Story in CSF? |
@@ -13,6 +13,7 @@ When you install [Storybook Docs](../README.md), `DocsPage` is the zero-config d | |||
- [Remixing DocsPage using doc blocks](#remixing-docspage-using-doc-blocks) |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
source: { | ||
state: 'open', | ||
}, | ||
}, |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
@@ -57,7 +53,7 @@ const getPreviewProps = ( | |||
return { | |||
...props, // pass through columns etc. | |||
withSource: sourceProps, | |||
isExpanded: withSource === SourceState.OPEN, |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
@frassinier do you mind updating the PR description for this to the updated code which shows that |
why this isnt documented in here https://storybook.js.org/docs/react/writing-docs/docs-page ? |
Issue: #10430
What I did
The property
isExpanded
was already available on<Canvas>
blockNow you can set
docs.source.state
on your Addon Docs configuration!How to test
Visit https://5a375b97f4b14f0020b0cda3-wplcskzipa.chromatic.com/?path=/docs/addons-controls--basic
Where Code bocks are shown by default now.
If your answer is yes to any of these, please make sure to include it in your PR.