Addon-docs: Chapter component
See original GitHub issueHi, I’d like to have some component like <Chapter/>
so I can put it above some section name in my .mdx file so I can see it in the sidebar on the left and navigate on it.
For example:
myComponent.stories.mdx:
imports...
# - myComponent
<Chapter name="Usage"/>
## Usage
...
<Chapter name="Imports"/>
## Imports
...
## Default
<Preview>
<Story name="Default" height="10px">
{...}
</Story>
</Preview>
## Special
<Preview>
<Story name="Special" height="10px">
{...}
</Story>
</Preview>
So in the sidebar:
- Usage
- Imports
- Default
- Special
Now, instead of it, I’m using <Story name="Usage" height="0px"/>
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
How to document components - Storybook
How to document components. When you write component stories during development, you also create basic documentation to revisit later. Storybook gives you tools ......
Read more >Storybook - Story With Chapters - Checkfront
React Storybook Chapters addon allows showcasing of multiple components within a story by breaking it down into smaller categories (Chapters) and ...
Read more >Storybook Docs with mdx support and addon knobs - Medium
We have used Storybook to document our React component library for a while, ... name: '@storybook/addon-docs', // new addon for docs
Read more >Storybook: Addon-Docs Cannot read property 'classes' of ...
So a work around exists, you export the "unwrapped" component and use that as the component in docs:.
Read more >@component-controls/storybook - npm
Allow an unlimited number of documentation pages. Fully replace and extend the Storybook addon-docs block components. Fully replace Storybook's modx-compiler ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@thuringia I just discovered storybook-docs-toc, while was searching for TOC solution for Storybook. Good starting point. But it doesn’t use Storybook or MDX, so it should be styled manually.
@shilman Thanks for the quick response 😃
While the second answer sounds much better in terms of developer experience, I’m on board with this not being on the roadmap. Major change doesn’t seem worthwhile for this feature at the moment. Some docs on how to work around this, as in the first one, sound really good though.
Right now, I’m thinking about something like the
:toc:
helper in AsciiDoc. That one should be fairly easy to do with some MDX extension. Maybe even with a one of the new v6 controls or something.It’s not really pressing on my end, so please don’t feel pressured. Meanwhile, I will check if MDX has an issue for this, may as well bump them. Then we wouldn’t have to so build this specifically for storybook.