question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Addon-docs: Chapter component

See original GitHub issue

Hi, 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:closed
  • Created 4 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
hudochenkovcommented, Sep 9, 2020

@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.

1reaction
thuringiacommented, Jul 1, 2020

@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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found