fbredius/storybook

View on GitHub
docs/snippets/vue/list-story-expanded.3.js.mdx

Summary

Maintainability
Test Coverage
```js
// List.stories.js

import List from './ListComponent.vue';
import ListItem from './ListItem.vue';

export default {
  /* 👇 The title prop is optional.
  * See https://storybook.js.org/docs/vue/configure/overview#configure-story-loading
  * to learn how to generate automatic titles
  */
  title: 'List',
  component: List,
};

export const Empty = (args) => ({
  components: { List },
  setup() {
    return { args };
  },
  template: '<list v-bind="args"/>',
});

export const OneItem = (args) => ({
  components: { List, ListItem },
  setup() {
    return { args };
  },
  template: '<list v-bind="args"><list-item/></list>',
});

export const ManyItems = (args) => ({
  components: { List, ListItem },
  setup() {
    return { args };
  },
  template: `
    <list v-bind="args">
      <list-item/>
      <list-item/>
      <list-item/>
    </list>
    `,
});
```