-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#143 To make hiding addon tab little easier.
- Loading branch information
Showing
3 changed files
with
68 additions
and
15 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { Meta, Story, Canvas } from '@storybook/addon-docs' | ||
import { Subtitle } from '@storybook/addon-docs/blocks' | ||
import { LinkTo } from '@storybook/addon-links' | ||
import { Badge } from '@storybook/components' | ||
|
||
import { PanelName } from 'storybook-addon-designs' | ||
|
||
<Meta title="Docs/Advanced Usage/Configure Tab" /> | ||
|
||
# Hide "Design" Tab | ||
|
||
<Subtitle>Tab renderer specific usage</Subtitle> | ||
|
||
You can hide `Design` tab by setting `previewTabs["STORYBOOK_ADDON_DESIGNS/panel"].hidden = true` parameter. For convenience, the addon exports the tab name as `PanelName`. | ||
|
||
```js | ||
// your.stories.js | ||
export const myStory = () => <MyComponent /> | ||
|
||
myStory.parameteras = { | ||
previewTabs: { | ||
'STORYBOOK_ADDON_DESIGNS/panel': { | ||
hidden: true, | ||
}, | ||
}, | ||
} | ||
|
||
// or... | ||
import { PanelName as DesignsAddon } from 'storybook-addon-designs' | ||
|
||
export const myStory = () => <MyComponent /> | ||
|
||
myStory.parameteras = { | ||
previewTabs: { | ||
[DesignsAddon]: { | ||
hidden: true, | ||
}, | ||
}, | ||
} | ||
``` | ||
|
||
<Canvas> | ||
<Story | ||
name="Sample" | ||
parameters={{ | ||
viewMode: 'docs', | ||
previewTabs: { [PanelName]: { hidden: true } }, | ||
}} | ||
> | ||
<button>Button</button> | ||
</Story> | ||
</Canvas> |
This file contains 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