-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23439 from storybookjs/chore_docs_autodocs_toc
Docs: Adds table of contents documentation
- Loading branch information
Showing
11 changed files
with
270 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
```ts | ||
// MyComponent.stories.ts | ||
|
||
import type { Meta } from '@storybook/angular'; | ||
|
||
import { MyComponent } from './MyComponent.component'; | ||
|
||
const meta: Meta<MyComponent> = { | ||
component: MyComponent, | ||
tags: ['autodocs'], | ||
parameters: { | ||
docs: { | ||
toc: { | ||
disable: true, // 👈 Disables the table of contents | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
export default meta; | ||
``` |
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,17 @@ | ||
```js | ||
// MyComponent.stories.js|jsx | ||
|
||
import { MyComponent } from './MyComponent'; | ||
|
||
export default { | ||
component: MyComponent, | ||
tags: ['autodocs'], | ||
parameters: { | ||
docs: { | ||
toc: { | ||
disable: true, // 👈 Disables the table of contents | ||
}, | ||
}, | ||
}, | ||
}; | ||
``` |
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,22 @@ | ||
```ts | ||
// MyComponent.stories.ts|tsx | ||
|
||
// Replace your-framework with the name of your framework | ||
import type { Meta } from '@storybook/your-framework'; | ||
|
||
import { MyComponent } from './MyComponent'; | ||
|
||
const meta = { | ||
component: MyComponent, | ||
tags: ['autodocs'], | ||
parameters: { | ||
docs: { | ||
toc: { | ||
disable: true, // 👈 Disables the table of contents | ||
}, | ||
}, | ||
}, | ||
} satisfies Meta<typeof MyComponent>; | ||
|
||
export default meta; | ||
``` |
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,22 @@ | ||
```ts | ||
// MyComponent.stories.ts|tsx | ||
|
||
// Replace your-framework with the name of your framework | ||
import type { Meta } from '@storybook/your-framework'; | ||
|
||
import { MyComponent } from './MyComponent'; | ||
|
||
const meta: Meta<typeof MyComponent> = { | ||
component: MyComponent, | ||
tags: ['autodocs'], | ||
parameters: { | ||
docs: { | ||
toc: { | ||
disable: true, // 👈 Disables the table of contents | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
export default meta; | ||
``` |
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,20 @@ | ||
```js | ||
// .storybook/preview.js | ||
|
||
export default { | ||
parameters: { | ||
docs: { | ||
toc: { | ||
contentsSelector: '.sbdocs-content', | ||
headingSelector: 'h1, h2, h3', | ||
ignoreSelector: '#primary', | ||
title: 'Table of Contents', | ||
disable: false, | ||
unsafeTocbotOptions: { | ||
orderedList: false, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}; | ||
``` |
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,25 @@ | ||
```ts | ||
// .storybook/preview.ts | ||
|
||
// Replace your-framework with the framework you are using (e.g., react, vue3) | ||
import { Preview } from '@storybook/your-framework'; | ||
|
||
const preview: Preview = { | ||
parameters: { | ||
docs: { | ||
toc: { | ||
contentsSelector: '.sbdocs-content', | ||
headingSelector: 'h1, h2, h3', | ||
ignoreSelector: '#primary', | ||
title: 'Table of Contents', | ||
disable: false, | ||
unsafeTocbotOptions: { | ||
orderedList: false, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
export default preview; | ||
``` |
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,11 @@ | ||
```js | ||
// .storybook/preview.js | ||
|
||
export default { | ||
parameters: { | ||
docs: { | ||
toc: true, // 👈 Enables the table of contents | ||
}, | ||
}, | ||
}; | ||
``` |
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,16 @@ | ||
```ts | ||
// .storybook/preview.ts | ||
|
||
// Replace your-framework with the framework you are using (e.g., react, vue3) | ||
import { Preview } from '@storybook/your-framework'; | ||
|
||
const preview: Preview = { | ||
parameters: { | ||
docs: { | ||
toc: true, // 👈 Enables the table of contents | ||
}, | ||
}, | ||
}; | ||
|
||
export default preview; | ||
``` |
15 changes: 15 additions & 0 deletions
15
docs/snippets/web-components/my-component-disable-toc.js.mdx
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,15 @@ | ||
```js | ||
// MyComponent.stories.js | ||
|
||
export default { | ||
component: 'my-component', | ||
tags: ['autodocs'], | ||
parameters: { | ||
docs: { | ||
toc: { | ||
disable: true, // 👈 Disables the table of contents | ||
}, | ||
}, | ||
}, | ||
}; | ||
``` |
18 changes: 18 additions & 0 deletions
18
docs/snippets/web-components/my-component-disable-toc.ts.mdx
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,18 @@ | ||
```ts | ||
// MyComponent.stories.ts | ||
|
||
import type { Meta } from '@storybook/web-components'; | ||
|
||
const meta: Meta = { | ||
component: 'my-component', | ||
tags: ['autodocs'], | ||
parameters: { | ||
docs: { | ||
toc: { | ||
disable: true, // 👈 Disables the table of contents | ||
}, | ||
}, | ||
}, | ||
}; | ||
export default meta; | ||
``` |
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