How to use the @storybook/vue.storiesOf function in @storybook/vue

To help you get started, we’ve selected a few @storybook/vue examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github storybookjs / vue-cli-plugin-storybook / generator / template / src / stories / index.stories.js View on Github external
/* eslint-disable import/no-extraneous-dependencies */
import { storiesOf } from '@storybook/vue'
import { action } from '@storybook/addon-actions'
import { linkTo } from '@storybook/addon-links'

import MyButton from '../components/MyButton.vue'

storiesOf('Button', module)
  .add('with text', () => ({
    components: { MyButton },
    template: 'Hello Button',
    methods: { action: action('clicked') }
  }))
  .add('with JSX', () => ({
    components: { MyButton },
    render() {
      return With JSX;
    },
    methods: { action: linkTo('Button', 'with some emoji') }
  }))
  .add('with some emoji', () => ({
    components: { MyButton },
    template: '😀 😎 👍 💯',
    methods: { action: action('clicked') }
github carbon-design-system / carbon-components-vue / storybook / stories / cv-text-input-story.js View on Github external
import { storiesOf } from '@storybook/vue';
import { text, boolean } from '@storybook/addon-knobs';
import { action } from '@storybook/addon-actions';

import SvTemplateView from '../_storybook/views/sv-template-view/sv-template-view';
// import consts from '../_storybook/utils/consts';
import knobsHelper from '../_storybook/utils/knobs-helper';

import CvTextInputNotesMD from '@carbon/vue/src/components/cv-text-input/cv-text-input-notes.md';
import { CvTextInput } from '@carbon/vue/src';

const storiesDefault = storiesOf('Components/CvTextInput', module);
const storiesExperimental = storiesOf('Experimental/CvTextInput', module);

const preKnobs = {
  theme: {
    group: 'attr',
    type: boolean,
    config: ['light-theme', false], // consts.CONFIG], // fails when used with number in storybook 4.1.4
    prop: 'theme',
    value: val => (val ? 'light' : ''),
  },
  label: {
    group: 'attr',
    type: text,
    config: ['label', 'Text input label'], // consts.CONTENT], // fails when used with number in storybook 4.1.4
    prop: 'label',
  },
github Royal-Navy / standards-toolkit / deprecated / vue-component-library / src / components / RnInput / RnInput.stories.js View on Github external
import { storiesOf } from '@storybook/vue'
import RnInput from './index.vue'

storiesOf('Inputs', module)
  .add('Text', () => ({
    components: { RnInput },
    data: () => ({
      user: 'Fred',
    }),
    template:
      '',
  }))
  .add('Number', () => ({
    components: { RnInput },
    data: () => ({
      users: '10',
    }),
    template:
      '',
  }))
github voorhoede / lean-web-kit / src / client / components / fixed-ratio / fixed-ratio.stories.js View on Github external
import { storiesOf } from '@storybook/vue';
import { withReadme } from 'storybook-readme';
import { withKnobs, number } from '@storybook/addon-knobs';
import readme from './readme.md';
import FixedRatio from './';
import './fixed-ratio.stories.css';

storiesOf('Fixed ratio', module)
  .addDecorator(withReadme(readme))
  .addDecorator(withKnobs)
  .add('Default', () => ({
    components: { FixedRatio },
    data() {
      return {
        images: [
          {
            width: number('Width size', 16),
            height: number('Height size', 9),
            text: `${number('Width size', 16)} x ${number('Height size', 9)}`
          },
          {
            width: 4,
            height: 3,
            text: '4 x 3'
github ulaval / modul-components / src / components / error-pages / error-cookies-not-supported / error-cookies-not-supported.stories.ts View on Github external
import { array, text } from '@storybook/addon-knobs';
import { storiesOf } from '@storybook/vue';
import Vue from 'vue';
import { componentsHierarchyRootSeparator } from '../../../../conf/storybook/utils';
import { ERROR_COOKIES_NOT_SUPPORTED_NAME } from '../../component-names';
import { Link } from '../../message-page/message-page';
import ErrorCookiesNotSupportedPlugin from './error-cookies-not-supported';

Vue.use(ErrorCookiesNotSupportedPlugin);



storiesOf(`${componentsHierarchyRootSeparator}${ERROR_COOKIES_NOT_SUPPORTED_NAME}`, module)


    .add('default', () => ({
        template: `<div style="border: solid 1px black; padding: 10px; width: 600px;">
                        
                   </div>`
    }))
    .add('title', () =&gt; ({
        props: {
            title: {
                default: text('Title', 'A Custom Title')
            }
        },
        template: `<div style="border: solid 1px black; padding: 10px; width: 600px;">
                        
                   </div>`
github milad-alizadeh / vue-cli-plugin-atomic-design-components / generator / template / src / components / molecules / VCarousel / index.stories.js View on Github external
import { storiesOf } from '@storybook/vue'
import { withInfo } from 'storybook-addon-vue-info'
import VCarousel from '.'
import VCarouselSlide from '../VCarouselSlide'

const wrapper = {
  components: { VCarousel, VCarouselSlide }
}

storiesOf('Molecule - VCarousel', module)
  .addDecorator(withInfo)
  .add('default', () =&gt; ({
    ...wrapper,
    template: `
      
        
          Slide 1
        
        
          Slide 2
        
        
          Slide 3
        
      
    `
github vuikit / vuikit / packages / vuikit / src / core / v-position / __dev__ / index.js View on Github external
import Default from './default.vue'
import { storiesOf } from '@storybook/vue'

storiesOf('Directives/Core', module)
  .add('v-position', () => Default)
github yunity / karrot-frontend / src / groupInfo / components / GroupGalleryCard.story.js View on Github external
import { groupsMock } from '>/mockdata'

const datastore = createDatastore({
  applications: {
    getters: {
      getMineInGroup: () => () => null,
    },
  },
})

const methods = {
  preview: action('view group preview'),
  visit: action('visit group'),
}

storiesOf('GroupGalleryCard', module)
  .add('isMember = true', () => defaults({
    render: h => h(GroupGalleryCard, {
      props: {
        group: {
          ...groupsMock[0],
          isMember: true,
        },
      },
      on: methods,
    }),
    store: datastore,
  }))
  .add('isMember = false', () => defaults({
    render: h => h(GroupGalleryCard, {
      props: {
        group: {
github yunity / karrot-frontend / src / users / components / ProfilePictures.story.js View on Github external
import { storybookDefaults as defaults } from '>/helpers'
import { storiesOf } from '@storybook/vue'

import ProfilePicture from './ProfilePicture'
import { usersMock } from '>/mockdata'

storiesOf('ProfilePicture', module)
  .add('with user', () => defaults({
    render: h => h(ProfilePicture, {
      props: {
        user: usersMock[0],
        isLink: false,
        size: 100,
      },
    }),
  }))
  .add('without user', () => defaults({
    render: h => h(ProfilePicture, {
      props: {
        user: {
          id: 1,
          displayName: '?',
        },
github DivanteLtd / storefront-ui / packages / vue / src / components / molecules / SfProductOption / SfProductOption.stories.js View on Github external
import { storiesOf } from "@storybook/vue";
import { withKnobs, text } from "@storybook/addon-knobs";

import SfProductOption from "./SfProductOption.vue";

storiesOf("Molecules|ProductOption", module)
  .addDecorator(withKnobs)
  .add("Common", () =&gt; ({
    components: { SfProductOption },
    props: {
      color: {
        default: text("color", "red", "Props")
      },
      label: {
        default: text("label", "Red", "Props")
      },
      value: {
        default: text("value", "red", "Props")
      }
    },
    template: `<div style="max-width: 300px">
      </div>