@productboard/storybook-addon-smart-knobs
v3.2.12
Published
Automatically created knobs for storybook.
Downloads
8
Keywords
Readme
Smart knobs addon for Storybook
This Storybook plugin uses @storybook/addon-knobs
but creates the knobs automatically based on PropTypes.
This fork has a goal of adding support for creating knobs from Flow type definitions next to PropTypes.
Installation:
npm i storybook-addon-smart-knobs --save-dev
Usage:
import React, { PropTypes } from 'react'
import { storiesOf } from '@storybook/react'
import { withKnobs } from '@storybook/addon-knobs'
import { withSmartKnobs } from 'storybook-addon-smart-knobs'
const Button = ({ children, onClick }) => (
<button onClick={ onClick }>{ children }</button>
)
Button.propTypes = {
children: PropTypes.node,
onClick: PropTypes.func
}
storiesOf('Button')
.addDecorator(withSmartKnobs)
.addDecorator(withKnobs)
.add('simple', () => <Button>Smart knobed button</Button>)