LoginSignup
4
2

More than 5 years have passed since last update.

Storybookのサイドバーのコンポーネントの表示を階層化する

Posted at

Storybookでコンポーネントを沢山った場合にカテゴリー、例えばAtomic DesignならMoleculesやOranismsなどで階層化したいときに便利です。
下記のような表示にすることができます。

img_side.png

方法

各storyのstoriesOf部分にスラッシュを利用するだけ!スラッシュで区切っていくと、その分階層が深くなります。

storiesOf('Molecules/Buttons/Simple', module).add('with text', () => (
  <Button onClick={action('clicked')}>Hello Button</Button>
));

また、StorybookのAddonのoptionsを利用し、下記プロパティの「hierarchySeparator」で「/」で切るか「.」で切るかなど設定ができるようです。

参考文献

4
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
2