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 Core
The @storybook/core
package is the core of Storybook. It is responsible for the following:
- the main UI of storybook
- the UI used by addons
- the API used by addons
- the API used by the CLI
- the API used by the server
- prebundled code used by the browser
- static assets used by the browser
- utilities for CSF, MDX & Docs
Private package
This package is not intended to be used by anyone but storybook internally.
Even though this is where all of the code is located, it is NOT to be the entry point when using functionality within!
Consumers of the code should import like so:
import { addons } from 'storybook/internal/manager-api';
Importing from @storybook/core
is explicitly NOT supported; it WILL break in a future version of storybook, very likely in a non-major version bump.
For maintainers
When to use @storybook/core
In the following packages you should import from @storybook/core
(and ONLY from @storybook/core
):
@storybook/core
@storybook/codemod
To prevent cyclical dependencies, these packages cannot depend on the storybook
package.
When to use storybook/internal
In every other package you should import from storybook/internal
(and ONLY from storybook/internal
).
The heuristic is simple:
If you see a peerDependency on storybook
in the package.json
of the package you are working on, you should import from storybook/internal
.
The 1 exception: the storybook
package itself
The sole exception is the storybook
package itself.
Obviously, the storybook
package cannot depend on itself, so it must import from @storybook/core
.