Gathering detailed insights and metrics for storybook-addon-next-router
Gathering detailed insights and metrics for storybook-addon-next-router
Gathering detailed insights and metrics for storybook-addon-next-router
Gathering detailed insights and metrics for storybook-addon-next-router
@storybook/nextjs
Storybook for Next.js
@storybook/addon-toolbars
Create your own toolbar items that control story rendering
@storybook/addon-essentials
Curated addons to bring out the best of Storybook
@storybook/addon-actions
Get UI feedback when an action is performed on an interactive element
Addon to use Next.js Router in Storybook
npm install storybook-addon-next-router
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
108 Stars
92 Commits
22 Forks
4 Watching
2 Branches
15 Contributors
Updated on 29 Sept 2024
TypeScript (95.64%)
JavaScript (2.34%)
Shell (2.01%)
Cumulative downloads
Total Downloads
Last day
7%
10,134
Compared to previous day
Last week
12.5%
54,990
Compared to previous week
Last month
3.7%
223,585
Compared to previous month
Last year
-54.3%
4,341,843
Compared to previous year
1
https://storybook.js.org/blog/integrate-nextjs-and-storybook-automatically/
Use Next.js Router in your Storybook stories.
Note: these docs refer to 3.0
Add the addon to your configuration in .storybook/main.js
1module.exports = { 2 ...config, 3 addons: [ 4 ...your addons 5 "storybook-addon-next-router", 6 ], 7};
Add the RouterContext.Provider to .storybook/preview.js
1import { AppRouterContext } from "next/dist/shared/lib/app-router-context"; // next 13 next 13 (using next/navigation) 2// import { RouterContext } from "next/dist/shared/lib/router-context"; // next 13 (using next/router) / next 12 3// import { RouterContext } from "next/dist/shared/lib/router-context"; // next 11.1 4// import { RouterContext } from "next/dist/next-server/lib/router-context"; // next < 11.1 5 6export const parameters = { 7 nextRouter: { 8 Provider: AppRouterContext.Provider, // next 13 next 13 (using next/navigation) 9 // Provider: RouterContext.Provider, // next 13 (using next/router) / next < 12 10 }, 11}
1import MyComponentThatHasANextLink from "../component-that-has-a-next-link"; 2 3export default { 4 title: "My Story", 5}; 6 7// if you have the actions addon 8// you can click the links and see the route change events there 9export const Example = () => <MyComponentThatHasANextLink />; 10 11Example.parameters = { 12 nextRouter: { 13 pathname: "/profile/[id]", 14 asPath: "/profile/lifeiscontent", 15 query: { 16 id: "lifeiscontent", 17 }, 18 }, 19};
in preview.js
1export const parameters = { 2 nextRouter: { 3 pathname: '/', // defaults to `/` 4 asPath: '/', // defaults to `/` 5 query: {}, // defaults to `{}` 6 push() { 7 } // defaults to using addon actions integration, 8 // can override any method in the router 9 } 10}; 11
Read more about the options available for next/router at https://nextjs.org/docs/api-reference/next/router
To see real world usage of how to use this addon, check out the example app:
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 7/20 approved changesets -- score normalized to 3
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
Reason
8 existing vulnerabilities detected
Details
Reason
project is archived
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More