StorybookJS | Need to display plain HTML in the "View Code" of a Story

349 views Asked by At

The "View Code" in the Docs of a Storybook component displays JSX since this is a React-based installation. (i.e. className instead of class).

I have tried the following and nothing changes.

/* Button.mdx */

<Canvas of={ButtonStories.Default} sourceState="shown" language="html"></Canvas> where language="html" is expected to output the source code in plain HTML.

or...

/* Button.stories.js */

    title: 'Components/Button',
    parameters: {
        docs: {
            source: { language: 'html' }, // <-- Not working
        },
    },
    argTypes: { ... },
};

where the parameters.docs.source.language is displaying JSX still.

The UI flickers when updates are made, but the display of the code remains JSX.

0

There are 0 answers