All Projects β†’ vue-play β†’ Vue Play

vue-play / Vue Play

Licence: mit
🍭 A minimalistic framework for demonstrating your Vue components

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Vue Play

Stackoverflow Clone
This project is a simplified a full stack clone of Stackoverflow.
Stars: ✭ 395 (-59.24%)
Mutual labels:  storybook
Storybook Readme
React Storybook addon to render README files in github style
Stars: ✭ 511 (-47.27%)
Mutual labels:  storybook
Antd Theme Editor
Customize and preview ant design theme and css styles overrides.
Stars: ✭ 22 (-97.73%)
Mutual labels:  storybook
Storybook Addon Designs
A Storybook addon that embed Figma, websites, PDF or images in the addon panel.
Stars: ✭ 441 (-54.49%)
Mutual labels:  storybook
React Event Timeline
A responsive event timeline in React.js
Stars: ✭ 504 (-47.99%)
Mutual labels:  storybook
React Cdk
under development - React Component Development Kit with Storybook
Stars: ✭ 583 (-39.83%)
Mutual labels:  storybook
Figma Html
Convert Figma designs to HTML, React, Vue, Angular, and more!
Stars: ✭ 382 (-60.58%)
Mutual labels:  storybook
React Redux Saga Starter
Basic, Opinionated starter kit for React+Redux+Redux Saga with support for SCSS CSS Modules, Storybook, JEST testing, and ESLint
Stars: ✭ 12 (-98.76%)
Mutual labels:  storybook
React Typescript Web Extension Starter
πŸ–₯ A Web Extension starter kit built with React, TypeScript, SCSS, Storybook, Jest, EsLint, Prettier, Webpack and Bootstrap. Supports Google Chrome + Mozilla Firefox + Brave Browser πŸ”₯
Stars: ✭ 510 (-47.37%)
Mutual labels:  storybook
Ravepro
RavePro
Stars: ✭ 18 (-98.14%)
Mutual labels:  storybook
Storycap
A Storybook Addon, Save the screenshot image of your stories πŸ“· via puppeteer.
Stars: ✭ 451 (-53.46%)
Mutual labels:  storybook
Ignite Andross
The original React Native boilerplate from Infinite Red - Redux, React Navigation, & more
Stars: ✭ 476 (-50.88%)
Mutual labels:  storybook
Storybook Deployer
Deploy your storybook as a static site
Stars: ✭ 670 (-30.86%)
Mutual labels:  storybook
Cuke Ui
πŸ₯’ ι»„η“œuiοΌšδΈ€δΈͺε³ζ’ε³η”¨ηš„React UI εΊ“
Stars: ✭ 402 (-58.51%)
Mutual labels:  storybook
Readteractive
Tool for writing and generating interactive books.
Stars: ✭ 23 (-97.63%)
Mutual labels:  storybook
Story2sketch
Convert Storybook into Sketch symbols πŸ’Ž
Stars: ✭ 391 (-59.65%)
Mutual labels:  storybook
Storybook Addon Material Ui
Addon for storybook wich wrap material-ui components into MuiThemeProvider. πŸ“ƒ This helps and simplifies development of material-ui based components.
Stars: ✭ 513 (-47.06%)
Mutual labels:  storybook
Express React Boilerplate
πŸš€πŸš€πŸš€ This is a tool that helps programmers create Express & React projects easily base on react-cool-starter.
Stars: ✭ 32 (-96.7%)
Mutual labels:  storybook
Next Boilerplate
A well-structured production ready Next.js boilerplate with Typescript, Redux, Jest, Enzyme, Express.js, Sass, Css, EnvConfig, Fetch, Reverse Proxy, Bundle Analyzer and Built-in Project CLI. https://pankod.github.io/next-boilerplate/
Stars: ✭ 936 (-3.41%)
Mutual labels:  storybook
Nx
Smart, Fast and Extensible Build System
Stars: ✭ 9,737 (+904.85%)
Mutual labels:  storybook

vue-play

NPM version NPM downloads Build Status gitter

A minimalistic framework for demonstrating your Vue components, inspired by react-storybook.

preview

Table of Contents

Getting Started

Integrate vue-play into your project using getplay:

yarn global add getplay
cd my-project
getplay

Then you can run yarn play and go to http://localhost:5000

So far we got:

  • npm scripts yarn play & yarn build:play
  • A ./play folder where you write scenarios for your component
  • A ./play.config.js file which helps you configure webpack easily using Poi

The only thing you really need to worry about is ./play/index.js, since you will write scenarios or dynamically load scenarios there.

Writing Scenarios

scenario, a.k.a. story in react-storybook, it's usually an example component for demonstrating your real component.

Keeping Scenarios

You can keep scenarios anywhere you want, by default keep them all at ./play/index.js, you can also use separate files for them, or even name them *.play.js in your component directory and load them dynamically.

Writing Scenarios

import { play } from 'vue-play'
import MyButton from '../src/components/MyButton.vue'

// Use `play` to describe component title
// use .add to add scenario for that component
play('MyButton')
  .add('with text', h => h(MyButton, ['hello world']))
  .add('with emoji', h => h(MyButton, ['πŸ˜ƒπŸ»']))

Loading Scenarios Dynamically

We can use Webpack's require.context to load modules dynamically.

const load = requireContext => requireContext.keys().map(requireContext)

// load files which end with `.play.js` in `../src/components` folder
load(require.context('../src/components', true, /.play.js$/))

Register Components

If you are using render function you won't need to register components, you only need this when you are using the template property, and it's same way as you do in other Vue app:

// ./play/index.js
import Vue from 'vue'
import MyButton from './MyButton.vue'

// register globally
Vue.component('my-button', MyButton)

play('MyButton')
  .add('with text', {
    template: '<my-button>text</my-button>'
  })

You can also register components locally.

Use Component as play() argument

import MyButton from './MyButton.vue'

// assuming MyButton.name is 'my-button'
play(MyButton)
  // MyButton will be automatially registered in scenarios
  // so you don't have to register it again
  .add('with text', '<my-button></my-button>')

// then the app sidebar will look like:
// - my-button
//    - with text

To customize the displayName in sidebar and the componentName which is used to register itself in scenarios, you can simply set them in your component:

<!-- ./MyButton.vue -->
<script>
  export default {
    name: 'my-other-button',
    displayName: 'Show off my cute button'
  }
</script>

Or use methods:

play(MyButton)
  .name('my-other-button')
  .displayName('Show off my cute button')
  .add('with text', '<my-other-button>text</my-other-button>')

Component Shorthand

If you only need template or render property for your component, you can use component shorthand, which means you can directly set the value of scenario to a template string or render function:

import Example from './Example.vue'
play('Button')
  .add('template shorthand', '<my-button>text</my-button>')
  .add('render function shorthand', h => h(MyButton, ['text']))
  .add('full component', {
    data() {},
    methods: {},
    render(h) {}
    // ...
  }).
  .add('single file', Example)

note: If you are using template shorthand or template property in component options, you should use Vue standalone build as well. For vue-play-cli, it's as simple as using --standalone option.

Additional Component Properties

The component for each scenario is a typical Vue component, but it can also accept some additional properties for documenting its usage, eg:

play('Button')
  .add('with text', {
    // a valid vue component
    ...component,
    // additional
    example,
    // ...
  })

example

Type: string

The example code of your component.

readme

Type: HTML string

Optionally display a readme tab to show detailed usage.

Component Injection

this.$log(data)

Log data to app console.

Showcase

Feel free to add your projects here:

Development

# run example play script
npm run play

# build vue-play
# you don't need this when developing
npm run build

License

MIT Β© EGOIST

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].