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

To help you get started, we’ve selected a few @storybook/svelte 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 farhan2106 / svelte-typescript / stories / WelcomePage.js View on Github external
import { storiesOf } from '@storybook/svelte';
import { withKnobs, text } from '@storybook/addon-knobs';
import { action } from '@storybook/addon-actions';
import WelcomePage from '../build/components/WelcomePage/WelcomePage.svelte';

storiesOf('WelcomePage', module)
  .addDecorator(withKnobs)
  .add('with text', () => {
    const name = text('name', 'user');
    return {
      Component: WelcomePage,
      data: {
        name,
        date: new Date()
      },
      on: {
        click: action('clicked')
      }
    }
  })
github storybookjs / storybook / examples / svelte-kitchen-sink / src / stories / addon-notes.stories.js View on Github external
import { storiesOf } from '@storybook/svelte';

import ButtonView from './views/ButtonView.svelte';

storiesOf('Addon|Notes', module)
  .add(
    'Simple note',
    () => ({
      Component: ButtonView,
    }),
    { notes: 'My notes on the [ButtonView](/story/addon-notes--simple-note) component' }
  )
  .add(
    'Note with HTML',
    () => ({
      Component: ButtonView,
      data: {
        text: '🤔😳😯😮😄😩😓😱🤓😑😶😊',
      },
    }),
    {
github storybookjs / storybook / lib / cli / generators / SVELTE / template / stories / index.stories.js View on Github external
import { storiesOf } from '@storybook/svelte';
import { action } from '@storybook/addon-actions';

import Button from './button.svelte';

storiesOf('Button', module)
  .add('with text', () => ({
    Component: Button,
    props: { text: 'Hello Button' },
    on: { click: action('clicked') },
  }))
  .add('with some emoji', () => ({
    Component: Button,
    props: {
      text: '😀 😎 👍 💯',
    },
    on: { click: action('clicked') },
  }));
github CollabCodeTech / collabstore-frontend / src / stories / TextfieldCollab.stories.js View on Github external
import { storiesOf } from '@storybook/svelte'
import TextfieldCollab from './views/atoms/TextfieldCollabView.svelte'

storiesOf('TextfieldCollab', module).add('Default', () => ({
  Component: TextfieldCollab,
  props: {
    placeholder: 'Nome',
  },
}))
github storybookjs / storybook / examples / svelte-kitchen-sink / src / stories / addon-actions.stories.js View on Github external
import { storiesOf } from '@storybook/svelte';
import { action } from '@storybook/addon-actions';

import ButtonView from './views/ButtonView.svelte';
import Button from '../components/Button.svelte';

storiesOf('Addon|Actions', module)
  .add('Action on view method', () => ({
    Component: ButtonView,
    on: {
      click: action('I am logging in the actions tab'),
    },
  }))
  .add('Action on component method', () => ({
    Component: Button,
    data: {
      text: 'Custom text',
    },
    on: {
      click: action('I am logging in the actions tab too'),
    },
  }));
github CollabCodeTech / collabstore-frontend / src / stories / CloseCollab.stories.js View on Github external
import { storiesOf } from '@storybook/svelte'
import CloseCollab from './views/atom/CloseCollabView.svelte'

storiesOf('CloseCollab', module).add('default', () => ({
  Component: CloseCollab,
}))
github storybookjs / storybook / examples / svelte-kitchen-sink / src / stories / addon-centered.stories.js View on Github external
import { storiesOf } from '@storybook/svelte';
import Centered from '@storybook/addon-centered/svelte';
import { action } from '@storybook/addon-actions';

import Button from '../components/Button.svelte';

storiesOf('Addon|Centered', module)
  .addDecorator(Centered)
  .add('rounded', () => ({
    Component: Button,
    props: {
      rounded: true,
      text: "Look, I'm centered!",
    },
  }))
  .add('with action', () => ({
    Component: Button,
    on: {
      click: action(`Tell me it ain't so! Centered and with actions! Thanks @ekhaled :)`),
    },
  }));

@storybook/svelte

Storybook Svelte renderer

MIT
Latest version published 5 days ago

Package Health Score

89 / 100
Full package analysis