storybook-states
TypeScript icon, indicating that this package has built-in type declarations

1.2.0 • Public • Published

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;

Readme

Keywords

none

Package Sidebar

Install

npm i storybook-states

Weekly Downloads

396

Version

1.2.0

License

MIT

Unpacked Size

21 kB

Total Files

35

Last publish

Collaborators

  • dzuc