Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-storybook-addon-props-combinations

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-storybook-addon-props-combinations

Props Combinations addon for React Storybook

  • 0.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.9K
increased by10.24%
Maintainers
1
Weekly downloads
 
Created
Source

Props Combinations addon for React Storybook

Given possible values for each prop, renders your component with all combinations of prop values. Useful for finding edge cases or just seeing all component states at once.

Live demo

Installation

Install it:

npm i -D react-storybook-addon-props-combinations

Then set the addon in your .storybook/config.js:

import { configure, setAddon } from '@kadira/storybook'

import withPropsCombinations, { setDefaults } from 'react-storybook-addon-props-combinations'

setAddon(withPropsCombinations)
setDefaults({
  // overwrite global defaults here
})

configure(() => {
  // ...
}, module)

Basic usage

import React from 'react';
import { storiesOf, action } from '@kadira/storybook';

import YourComponent from './somewhere'

storiesOf('Basics', module)
  .addWithPropsCombinations(
    'Standard usage',
    // provide your component
    YourComponent,
    // and an object with the shape
    // {propName: arrayOfPossiblevalues}
    {
      disabled: [false, true],
      onClick: [action('clicked')],
      children: ['hello world', <b>some elements</b>]
    }
  )

Options

Are provided as 4th argument to addWithPropsCombinations or set globally using setDefaults

showSource

default: true

Toggles rendering of sample source for each combination.

Example source | Result

mustProvideAllProps

default: false

Ensures that possible values are provided for all props listed in propTypes.

Example source | Result

renderCombination

default implementation

A function that renders a single props combination for your component. Takes Component, props and options as arguments.

Example source | Result

Keywords

FAQs

Package last updated on 06 Dec 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc