-
-
Notifications
You must be signed in to change notification settings - Fork 10.1k
Added documentation for the table of contents #33867
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
57efa5a
Added documentation for the table of contents
txgh25 6498da1
Fix parameter name in TableOfContents documentation
txgh25 06adf12
Fix syntax for Meta component in Table of Contents
txgh25 5b33d42
Update namespace for TableOfContents parameters
txgh25 2d3a386
Update title in Table of Contents documentation
txgh25 fdb384b
Update documentation for table of contents properties
txgh25 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,96 @@ | ||
| --- | ||
| title: 'TableOfContents' | ||
| sidebar: | ||
| order: 18 | ||
| title: TableOfContents | ||
| --- | ||
|
|
||
| The `TableOfContents` doc block displays an automatically generated list of links to other headings on the current page in the format of a table. | ||
|
|
||
| <Callout variant="info"> | ||
| To use the storybook "sidebar" table of contents layout, it should be configured with `parameters.docs.toc` | ||
| </Callout> | ||
|
|
||
| {/* prettier-ignore-start */} | ||
|
|
||
| ```md title="TableOfContentsDocs.mdx" | ||
| import { Meta, TableOfContents } from '@storybook/addon-docs/blocks'; | ||
|
|
||
| <Meta title="Docs/TableOfContents"/> | ||
|
|
||
| ## Table of Contents | ||
|
|
||
| <TableOfContents title="Example Toc" headingSelector="h2,h3"/> | ||
|
|
||
| ## Section 1 | ||
|
|
||
| ## Section 2 | ||
|
|
||
| ``` | ||
|
|
||
| {/* prettier-ignore-end */} | ||
|
|
||
| ### `TableOfContents` | ||
|
|
||
| ```js | ||
| import { TableOfContents } from '@storybook/addon-docs/blocks'; | ||
| ``` | ||
|
|
||
| TableOfContents accepts the following props: | ||
|
|
||
| ### `title` | ||
|
|
||
| Type: `string | JSX.Element` | ||
|
|
||
| Determine the title to be displayed above the table of contents. | ||
|
|
||
|
|
||
| ### `disable` | ||
|
|
||
| Type: `boolean` | ||
|
|
||
| When set to `true` prevents the rendering of the table. | ||
|
|
||
|
|
||
| ### `headingSelector` | ||
|
|
||
| Type: `string` | ||
| Default: `h3` | ||
|
|
||
| CSS selector to determine which headings to include in the table of contents. | ||
|
|
||
| ### `contentsSelector` | ||
|
|
||
| Type: `string` | ||
| Default: `.sbdocs-content` | ||
|
|
||
| CSS selector to determine the container that holds the content to be scanned for headings. | ||
|
|
||
| ### `ignoreSelector` | ||
|
|
||
| Type: `string` | ||
| Default: `.docs-story *, .skip-toc` | ||
|
|
||
| CSS selector to determine which elements to ignore when scanning for headings. | ||
|
|
||
| ### `className` | ||
|
|
||
| Type: `string` | ||
|
|
||
| Apply custom CSS classes to the table of contents' wrapping element. | ||
|
|
||
| ### `unsafeTocbotOptions` | ||
|
|
||
| Type: `object` | ||
|
|
||
| Additional options to be passed directly to the underlying Tocbot. | ||
| Use as an escape hatch for features not yet supported by the TableOfContents component. | ||
|
|
||
| ### `channel` | ||
|
|
||
| Type: `Channel` | ||
|
|
||
| Storybook's event channel to be used for navigation when clicking items in the table. | ||
| This is automatically injected so does not need to be set up manually. | ||
|
|
||
|
|
||
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.