Code preview with CSF Stories with MDX Docs shows only imported function
See original GitHub issueDescribe the bug When creating story according to this recipe https://github.com/storybookjs/storybook/blob/next/addons/docs/docs/recipes.md#csf-stories-with-mdx-docs
To Reproduce Steps to reproduce the behaviour:
- Create story by recipe mentioned above
- Start storybook
- See the docs tabs
Expected behaviour Code will be available from real story
Screenshots
Code snippets
import { Meta, Story, Preview } from "@storybook/addon-docs/blocks";
import * as stories from "./mix.stories.js";
<Meta title="a/mix" />
# Button
<Preview>
<Story name="basic">{stories.basic()}</Story>
</Preview>
import React from "react";
import { Button } from "@storybook/react/demo";
export default {
title: "a/mix",
includeStories: []
};
export const basic = () => <Button>Hello Button</Button>;
System:
System:
OS: macOS 10.15.2
CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
Binaries:
Node: 12.13.1 - ~/.nvm/versions/node/v12.13.1/bin/node
Yarn: 1.21.1 - /usr/local/bin/yarn
npm: 6.12.1 - ~/.nvm/versions/node/v12.13.1/bin/npm
Browsers:
Chrome: 79.0.3945.130
Firefox: 70.0.1
Safari: 13.0.4
npmPackages:
@storybook/addon-actions: ^5.3.7 => 5.3.7
@storybook/addon-docs: ^5.3.7 => 5.3.7
@storybook/addon-links: ^5.3.7 => 5.3.7
@storybook/addons: ^5.3.7 => 5.3.7
@storybook/react: ^5.3.7 => 5.3.7
Issue Analytics
- State:
- Created 4 years ago
- Reactions:11
- Comments:10 (4 by maintainers)
Top Results From Across the Web
MDX - Storybook
MDX -flavored Component Story Format (CSF) includes a collection of components called "Doc Blocks", that allow Storybook to translate MDX files into Storybook ......
Read more >Setup CSF + MDX stories with @storybook/addon-docs - GitLab
Component Story Format (CSF) is a new way to write stories that drops ... shown below stories and are also imported in design.gitlab.com...
Read more >Storybook Docs with mdx support and addon knobs - Medium
To get this source code to show up, we need to add source: true in the example .storybook/preview.js file at the top of...
Read more >Storybook for everyone: CSF vs. MDX - DEV Community
The PropTypes function will be used in our Docs Block later to show our ArgsTable with all the args (props) included in our...
Read more >storybook/addon-docs - npm
import { Meta, Story, Canvas } from '@storybook/addon-docs'; import { Checkbox } from './Checkbox'; <Meta title="MDX/Checkbox" ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hope to spend time on this during this 6.0 cycle. This is a dealbreaker for the currently recommended CSF/MDX mix.
@lpoulter Sure. Here you go using the OP examples:
mdx
story
If you are using the external
Source
block you can also pipe the source code in without theMeta
param approach:which could potentially let you get into more complicated combinations depending upon what you are doing with your mdx layout. Or the last option we found was you can pipe it to the Story directly for more control if you have multiple
Preview
blocks:HTH.