What is storybook?
Storybook is an open-source tool for developing UI components in isolation for React, Vue, Angular, and more. It makes building stunning UIs organized and efficient. Storybook provides a sandbox to build UI components in isolation so you can develop hard-to-reach states and edge cases.
What are storybook's main functionalities?
UI Component Exploration
Developers can browse through the components and their different states to understand how components look and feel in isolation.
n/a
UI Component Documentation
Storybook allows developers to create documentation for each component, which can include usage instructions, design notes, and other important information.
n/a
Visual Testing
With Storybook, you can write stories to capture the states of your UI components. These stories can then be used for visual regression testing.
n/a
Interactive Component Playground
Storybook provides an interactive playground for your components, allowing you to manipulate props, check accessibility, and play with the component's state.
n/a
Other packages similar to storybook
react-styleguidist
React Styleguidist is a component development environment with a hot-reloaded dev server. It's similar to Storybook but focuses more on living style guides, and it uses Markdown for documentation.
docz
Docz leverages MDX to bring Markdown and JSX together into one file, enabling easier documentation writing for your components. It's simpler to set up than Storybook but might not be as feature-rich.
playroom
Playroom allows you to simultaneously design across a variety of themes and screen sizes, powered by JSX and your own component library. It's different from Storybook in that it focuses on layout and design rather than component isolation.
Storybook (CLI)
This package provides a CLI for adding Storybook to your project.
The quickest way to add Storybook to your project is to run this package via npx:
cd your-project-folder
npx storybook
That's all you've to do.
If you don't use npx install this CLI globally.
npm i -g storybook
Then go to your project's folder and run:
storybook
After that run Storybook by
npm run storybook
or
yarn storybook
For more information visit: storybook.js.org
It also supports yarn.
If you have installed yarn in your system, it'll detect it and use yarn
instead of npm
.
If you don't want to use yarn
always you can use the --use-npm
option like this:
storybook --use-npm
It also supports flow files. By default, jscodeshift, the tool used to transform the source files, uses babel to read the files. To be able to transform any flow annotated file, you need to use the flow parser.
storybook --parser flow
Credits
npm package: https://www.npmjs.com/package/storybook
github repo: https://github.com/storybooks/storybook-package
Storybook monorepo: https://github.com/storybooks/storybook
in order to have the latest Storybook CLI install:
npm i -g @storybook/cli