Storybook: How do you pass args to Veutify component story?

Created on 11 Nov 2020  路  3Comments  路  Source: nuxt-community/storybook

I'm trying to add Vuetify components as Storybook stories in a Nuxt project and pass Storybook args. This Github repo has a great example, but doesn't illustrate how to pass args to the Vuetify component (link).

When I try the following syntax I get Vue console errors stating that the properties aren't reactive.

export const SelectArgs = ({ label, items }) =>
  '<v-app><v-select "label="label" :items="items" ></v-select></v-app>'
SelectArgs.args = { items: ['Foo', 'Bar', 'Fizz', 'Buzz'], label: 'standard' }

Is there a supported method to pass arguments through to Vueitify components like this?

question

All 3 comments

Define props for your story:

export const SelectArgs = ({ label, items }) => ({
    props: ['items', 'label'],
    template: '<v-app><v-select "label="label" :items="items" ></v-select></v-app>'
});
SelectArgs.args = { items: ['Foo', 'Bar', 'Fizz', 'Buzz'], label: 'standard' }

@farnabaz that's the syntax. Thank you.

Demo repo for folks that stumble upon this.
https://github.com/dankellett/clean-nuxt-storybook-vuetify

Was this page helpful?
0 / 5 - 0 ratings

Related issues

macieklad picture macieklad  路  4Comments

armorkram picture armorkram  路  3Comments

altryne picture altryne  路  3Comments

gabimor picture gabimor  路  4Comments

Sananes picture Sananes  路  3Comments