Does excludeDecorators work in Source doc blocks? · storybookjs/storybook · Discussion #36515 · GitHub
Skip to content
Discussion options

You must be logged in to vote

excludeDecorators currently does not work as a per-<Source> prop, so your reproduction matches the implementation rather than an MDX mistake.

SourceProps does not declare, consume, or forward excludeDecorators. For the HTML renderer, source generation only checks:

context.parameters.docs.source.excludeDecorators

The working configuration is therefore a story parameter:

export const PrimaryWithoutDecorators = {
  ...Primary,
  parameters: {
    docs: {
      source: {
        excludeDecorators: true,
      },
    },
  },
};

Then reference both variants:

<Source of={ButtonStories.Primary} />
<Source of={ButtonStories.PrimaryWithoutDecorators} />

Because the value comes from the story contex…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@oldfieldtc
Comment options

Answer selected by oldfieldtc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants