All Projects → pocka → Storybook Addon Vue Info

pocka / Storybook Addon Vue Info

Licence: mit
Info addon for Vue components

Programming Languages

javascript
184084 projects - #8 most used programming language
typescript
32286 projects

Projects that are alternatives of or similar to Storybook Addon Vue Info

Reactivetradercloud
Real-time FX trading showcase by Adaptive.
Stars: ✭ 1,664 (+856.32%)
Mutual labels:  storybook
Storybook
Storybook integration with Nuxt.js
Stars: ✭ 148 (-14.94%)
Mutual labels:  storybook
React Rough
🐇 React Components for Rough.js
Stars: ✭ 164 (-5.75%)
Mutual labels:  storybook
React Responsive Carousel
React.js Responsive Carousel (with Swipe)
Stars: ✭ 1,962 (+1027.59%)
Mutual labels:  storybook
React Laravel Boilerplate
A Laravel REST API backend with React/Redux, hot module reloading in development and route-level code splitting
Stars: ✭ 146 (-16.09%)
Mutual labels:  storybook
Workflow Reactjs
My workflow with ReactJS + Webpack 3+
Stars: ✭ 150 (-13.79%)
Mutual labels:  storybook
React95
A React components library with Win95 UI
Stars: ✭ 1,779 (+922.41%)
Mutual labels:  storybook
Storybook Addon Styled Component Theme
storybook addon
Stars: ✭ 168 (-3.45%)
Mutual labels:  storybook
Vue Storybook
Custom <story> blocks for Vue single file components
Stars: ✭ 147 (-15.52%)
Mutual labels:  storybook
Creevey
Cross-browser screenshot testing tool for Storybook with fancy UI Runner.
Stars: ✭ 155 (-10.92%)
Mutual labels:  storybook
React Storybook Addon Props Combinations
Given possible values for each prop, renders your component with all combinations of prop values.
Stars: ✭ 130 (-25.29%)
Mutual labels:  storybook
Typescript With Electron React Kit
Don't just start your Electron app... TWERKit.
Stars: ✭ 143 (-17.82%)
Mutual labels:  storybook
Babel Plugin React Docgen
📝 Babel plugin to add react-docgen info into your code.
Stars: ✭ 156 (-10.34%)
Mutual labels:  storybook
Mhy
🧩 A zero-config, out-of-the-box, multi-purpose toolbox and development environment
Stars: ✭ 128 (-26.44%)
Mutual labels:  storybook
Awesome Storybook
A collection of awesome resources about @storybookjs ecosystem 🎨
Stars: ✭ 165 (-5.17%)
Mutual labels:  storybook
Storybook Addon
Develop themable components with Emotion/Styled Components/Material-UI with help of Storybook & React Theming
Stars: ✭ 122 (-29.89%)
Mutual labels:  storybook
React Storybook Addon Chapters
📒 Showcase multiple React components within a story
Stars: ✭ 149 (-14.37%)
Mutual labels:  storybook
2019 12
🎟 급증하는 트래픽에도 안정적인 예약 서비스, Atomic Pattern을 적용한 재사용 가능한 컴포넌트, 실용적인 Testing을 주제로 하는 이벤트 서비스
Stars: ✭ 169 (-2.87%)
Mutual labels:  storybook
Qui
A Vue.js design-system for Web.
Stars: ✭ 165 (-5.17%)
Mutual labels:  storybook
Cra Recipe
Step-by-step guide to bootstrap a CRA app from scratch.
Stars: ✭ 158 (-9.2%)
Mutual labels:  storybook

Deprecated

This addon is deprecated due to the retirement of official addon-info.

Storybook now has an alternative addon, called Docs addon(addon-docs), which comes with native Vue.js support and automatically props/events/slots documentation powered by vue-docgen-api.

There will be no feature addition nor bug fixes to this repo. Please use Docs addon instead.

Migration to Docs

As described above, Docs addon uses vue-docgen-api via vue-docgen-loader. They are also the tools storybook-addon-vue-info uses internally. So the migration steps is quite simple.

docgen tools are no longer peerDependencies

Since the Docs addon specifies vue-docgen-api and vue-docgen-loader as direct dependency, you don't have to list them in your package.json.

 "dependencies": {
-  "vue-docgen-api": "x.x.x",
-  "vue-docgen-loader": "x.x.x"
 }

Of course, you can keep them to controll which exact versions to use.

Explicitly specify which component to documentate

You need to set component field in your story metadata.

// foo.stories.js
import MyComponent from './my-component.vue'

export default {
  title: 'Components/MyComponent',
  component: MyComponent
}

export const story = () => ({
  components: { MyComponent },
  template: '<my-component/>'
})

Move summary inside a JSDoc comment or MDX

summary option equivalent in Docs addon is component comments or MDX. Docs addon reads a component comment and displays it as a description for the component.

// legacy.stories.js
export const myStory = () => ({
  /* ... */
})

myStory.story = {
  info: {
    summary: 'foo bar'
  }
}
<!-- component -->
<script>
  /**
   * foo bar
   */
  export default {
    /* ... */
  }
</script>

Or you can use MDX for more complicated usage.


logo

Build Status npm version Monthly download GitHub license code style: prettier


storybook-addon-vue-info

A Storybook addon that shows Vue component's information.

Requirements

  • @storybook/vue>=4.0.0

Getting started

First, install the addon.

npm install --save-dev storybook-addon-vue-info

# yarn add -D storybook-addon-vue-info

Then register in addons.js.

// .storybook/addons.js

// Don't forget "/lib/" !!
import 'storybook-addon-vue-info/lib/register'

And setup a webpack loader in order to extract component information with vue-docgen-api.

npm install --save-dev vue-docgen-loader vue-docgen-api

# yarn add -D vue-docgen-loader vue-docgen-api
// .storybook/webpack.config.js

// This example uses "Full control mode + default".
// If you are using other mode, add payload of `config.module.rules.push` to rules list.
module.exports = ({ config }) => {
  config.module.rules.push({
    test: /\.vue$/,
    loader: 'vue-docgen-loader',
    enforce: 'post'
  })

  return config
}

Usage

Add withInfo decorator then set info options to the story.

NOTE: info option is required for the addon. If you omit it, the addon does nothing.

import { storiesOf } from '@storybook/vue'

import { withInfo } from 'storybook-addon-vue-info'

storiesOf('MyComponent', module)
  .addDecorator(withInfo)
  .add(
    'foo',
    () => ({
      components: { MyAwesomeComponent },
      template: '<my-awesome-component/>'
    }),
    {
      info: {
        summary: 'Summary for MyComponent'
      }
    }
  )

You can set the addon as global decorator.

// config.js
import { addDecorator } from '@storybook/vue'

import { withInfo } from 'storybook-addon-vue-info'

addDecorator(withInfo)

To set default options, use setDefaults.

// .storybook/config.js
import { setDefaults } from 'storybook-addon-vue-info'

setDefaults({
  header: false
})

For more details, see live examples.

Options

Name Data type Default value Description
header boolean true Whether to show header or not.
source boolean true Whether to show source(usage) or not.
wrapperComponent Component default wrapper Override inline docs component.
previewClassName string undefined Class name passed down to preview container.
previewStyle Style object undefined Style passed down to preview container.
summary string '' Summary for the story. Accepts Markdown.
components { [name: string]: Component }|null null Display info for these components. Same type as component's components property.
docsInPanel boolean true Whether to show docs in addon panel.
useDocgen boolean true Whether to use result of vue-docgen-api.
casing "kebab" | "camel" | "pascal" | undefined undefined Which case to use. For detailed usage, see below.

Valid casing options

{
  // Don't convert names
  casing: undefined
}

{
  // Show names in kebab-case
  casing 'kebab'
}

{
  // Show prop names in camelCase and
  // Show component names in PascalCase
  casing: 'camel' // or 'pascal'
}

{
  // Show prop names in camelCase and
  // Show component names in kebab-case
  casing: {
    props: 'camel',
    component: 'kebab'
  }
}

In addition to addon options, we have a component option.

Set descriptions manually

With vue-docgen-api, the addon automatically shows descriptions and types extracted by docgen (see example in vue-docgen-api README). However, if you want to explicitly specify desciprion for component props, events or slots, add description option for your story component.

Assume <my-awesome-component> have props label and visible.

storiesOf('MyComponent', module)
  .addDecorator(withInfo)
  .add(
    'foo',
    () => ({
      components: { MyAwesomeComponent },
      template: '<my-awesome-component/>',
      description: {
        MyAwesomeComponent: {
          props: {
            // These description will appear in `description` column in props table
            label: 'A label for my awesome component',
            visible: 'Whether component is visible or not'
          },
          events: {
            click: 'Event for user clicking the component'
          },
          slots: {
            default: 'Place text or icon here'
          }
        }
      }
    }),
    {
      info: true
    }
  )

For more detail, please take a look at live example.

Example

For real example, see example directory.

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].