Search code examples
storybook

How to disable 'Docs' tab in storybook?


How do i disable the 'docs' (addons-docs) tab on a per story basis?

I've tried adding the key values below to a story, but nothing seems to work.

parameters: {
  docs: { disable: true, hidden: true }
},

I'm running Storybook 5.3.8.


Solution

  • I managed to do it with the v6.0.0-alpha.28 (@storybook/*@next) with the new parameters:

      previewTabs: {
        docs: { hidden: true },
      }
    

    I've added the default config on preview.js:

    addParameters({
      previewTabs: {
        docs: {
          hidden: false
        },
        canvas: {
          title: 'Story',
          hidden: false,
        },
      },
    })
    

    and also repositioned the Docs to be the first tab on manager.js:

    import { addons } from '@storybook/addons';
    
    addons.setConfig({
      previewTabs: {
        'storybook/docs/panel': { index: -1 },
      },
    });
    

    Hope it works on the long term :) Enjoy!