Skip to content

Commit c445999

Browse files
authored
[Storybook] Fix docs (and enable TOC on stories) (#2565)
## Summary: @third [noticed](#2543 (comment)) that our Storybook docs weren't working anymore. This is a regression that happened during the Storybook v9 upgrade. This PR fixes autodocs (and enables the TOC feature which is a nice little addition). Issue: "none" ## Test plan: `pnpm install; pnpm start` -> stories have a "Docs" entry again Author: jeremywiebe Reviewers: SonicScrewdriver Required Reviewers: Approved By: SonicScrewdriver Checks: ✅ 8 checks were successful Pull Request URL: #2565
1 parent b83bdf3 commit c445999

File tree

5 files changed

+84
-2
lines changed

5 files changed

+84
-2
lines changed

.changeset/odd-moose-hope.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---

.storybook/main.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,11 @@ const config: StorybookConfig = {
3838
// dir.
3939
"../packages/*/src/**/*@(.stories|.fixturestories).@(ts|tsx)",
4040
],
41-
42-
addons: ["@storybook/addon-links", "@storybook/addon-a11y"],
41+
addons: [
42+
"@storybook/addon-a11y",
43+
"@storybook/addon-docs",
44+
"@storybook/addon-links",
45+
],
4346

4447
// NOTE(kevinb): We customize the padding a bit so that so that stories
4548
// using the on-screen keypad render correctly. Storybook adds its own

.storybook/preview.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ const preview: Preview = {
8787
value,
8888
})),
8989
},
90+
docs: {
91+
toc: true,
92+
},
9093
},
9194
tags: [
9295
//👇 Enables auto-generated documentation for all stories

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"@rollup/plugin-swc": "^0.4.0",
3333
"@sheerun/mutationobserver-shim": "^0.3.3",
3434
"@storybook/addon-a11y": "^9.0.4",
35+
"@storybook/addon-docs": "^9.0.5",
3536
"@storybook/addon-links": "^9.0.4",
3637
"@storybook/react-vite": "^9.0.4",
3738
"@swc-node/register": "^1.10.10",

pnpm-lock.yaml

Lines changed: 73 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)