dzucconi / storybook-states

Visually drive out component states in Storybook

Home Page:https://www.npmjs.com/package/storybook-states

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

storybook-states

Visually drive out component states in Storybook

semantic-release npm Build Status

What is this?

Wrap your component and use an array of states to drive out different variations in Storybook.

Installation

yarn add storybook-states

Usage

export const Example = () => (
  <States<ButtonProps>
    states={[
      {},
      { children: "Goodbye" },
      { outlined: true },
      { outlined: false }
    ]}
  >
    <Button onClick={action("clicked")}>Hello</Button>
  </States>
);

Example

View the example stories for more usage details.

Interface

const States: <T>({
  states,
  children,
  styles,
  ...rest
}: Props<T>) => JSX.Element;

About

Visually drive out component states in Storybook

https://www.npmjs.com/package/storybook-states

License:MIT License


Languages

Language:TypeScript 94.7%Language:JavaScript 5.3%