Last active
May 6, 2024 12:36
-
-
Save yairEO/89d1d660812bf8f1c3036dbca7249f19 to your computer and use it in GitHub Desktop.
storybook MDX - show code block of imported file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Meta, Description, Props, Source, Canvas } from '@storybook/addon-docs/blocks'; | |
import Comp from './Comp'; | |
import CompRaw from '!raw-loader!./Comp.jsx'; | |
import readme from '!raw-loader!./readme.md'; | |
<Meta | |
title="Comp/MDX" | |
component={Comp} | |
/> | |
<Description markdown={readme} /> | |
<br/> | |
<Canvas> | |
<Story name="custom source" height="100px" parameters={{ docs: { source: { code: Comp } } }}> | |
<code>Comp.jsx</code> | |
</Story> | |
</Canvas> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Alternatively: