Gathering detailed insights and metrics for storybook-vue-router
Gathering detailed insights and metrics for storybook-vue-router
Gathering detailed insights and metrics for storybook-vue-router
Gathering detailed insights and metrics for storybook-vue-router
storybook-vue3-router
A Storybook decorator that allows you to build stories for your routing-aware components.
@dorinbotan/storybook-vue-router
A storybook decorator that allows you to use routing-aware components in your stories.
potatify
This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
@netsells/storybook-router
This package provides an easy and convenient way to provide routes to your Vue-based stories.
A storybook decorator that allows you to use routing-aware components in your stories
npm install storybook-vue-router
Typescript
Module System
Node Version
NPM Version
77.2
Supply Chain
94.7
Quality
75.3
Maintenance
50
Vulnerability
99.6
License
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
258 Stars
58 Commits
32 Forks
3 Watchers
15 Branches
6 Contributors
Updated on Oct 16, 2024
Latest Version
1.0.7
Package Id
storybook-vue-router@1.0.7
Size
4.05 kB
NPM Version
lerna/3.16.4/node@v10.15.3+x64 (darwin)
Node Version
10.15.3
Published on
Sep 02, 2019
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
A Storybook decorator that allows you to use your routing-aware components.
npm install --save-dev storybook-vue-router
The decorator is actually a function which wraps the VueRouter
instance. It accepts two optional arguments that you can use if you want to build a prototype of your navigation within storybook or if you need more control over the router itself.
In its default behavior the decorator just log every route action perfomed using the storybook action logger. If you are fine with the default arguments you can add globally the StoryRouter
decorator, however if you need to specify some of the arguments you have to use the decorator for every story that needs it.
Suppose you have a navigation bar that uses the vue-router router-link
:
1const NavBar = { 2 template: ` 3 <div> 4 <router-link to="/">Home</router-link> 5 <router-link to="/about">About</router-link> 6 </div>` 7};
you can define a story for your component just like this:
1import { storiesOf } from '@storybook/vue'; 2import StoryRouter from 'storybook-vue-router'; 3 4storiesOf('NavBar', module) 5 .addDecorator(StoryRouter()) 6 .add('default', () => NavBar);
or if you want to include in your story the target components (with a local navigation) you can write:
1import { storiesOf } from '@storybook/vue'; 2import StoryRouter from 'storybook-vue-router'; 3 4const Home = { 5 template: '<div>Home</div>' 6}; 7 8const About = { 9 template: '<div>About</div>' 10}; 11 12storiesOf('Navigation', module) 13 .addDecorator(StoryRouter({}, { 14 routes: [ 15 { path: '/', component: Home }, 16 { path: '/about', component: About } 17 ]})) 18 .add('local', () => ({ 19 components: { NavBar }, 20 template: ` 21 <div> 22 <nav-bar/> 23 <router-view/> 24 </div>` 25 }));
The first argument is an object that you can use to extend the default behavior.
Every time that a key in the object matches with a path Storybook will call the callback specified for the corresponding value with the destination path as argument.
This way you can for example link stories together using the links
addons with the linkTo function.
The link keys need to be equal (===
) to the fullPath of the destination route.
The second argument is another object you can use to specify one of the vue-router constructor options plus a couple of specific StoryRouter
options:
'/'
]You can find more examples in the provided stories. You can run them cloning this repository and executing (supposing you have installed globally lerna):
yarn install && yarn bootstrap
yarn storybook-vue-examples
As the wrapped VueRouter uses the browser history API which is quite limited (for example, it is not possible to reset the history stack) the same limitations apply to the StoryRouter
decorator.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 4/30 approved changesets -- score normalized to 1
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
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
Reason
162 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
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