Tschareck
Tschareck

Reputation: 4239

Hide Docs tab in Storybook

I want to create stories using both Typescript and MDX, therefore I have in my main.js:

module.exports = {
  stories: ['../src/**/*.stories.(mdx|ts)'],
  addons: ['@storybook/addon-docs', 'storybook-addon-preview']
};

However I don't want to have "Docs" tab next to "Canvas". How do I remove it? Without '@storybook/addon-docs' MDX story is not displayed.

Upvotes: 1

Views: 4572

Answers (2)

Benjamin
Benjamin

Reputation: 1286

I am currently using @storybook/[email protected] and the previous answer unfortunately did not work for me. I was able to find a solution in the storybook DocsPage documentation.

The relevant section:

You can replace DocsPage at any level by overriding the docs.page parameter:

- With null to remove docs
- With MDX docs
- With a custom React component

I was able to completely remove the DocsPage for a single story like this:

export const myStory = () => ({
  moduleMetadata: MODULE_METADATA,
  component: MyComponent,
});
myStory.parameters = {
  docs: { page: null },
};

Upvotes: 1

Tschareck
Tschareck

Reputation: 4239

Put this in preview.js:

export const parameters = {
  previewTabs: {
    'storybook/docs/panel': {
      hidden: true
    }
  }
};

Used in Storybook version 6.0.x

Upvotes: 5

Related Questions