1 | # Storybook for React
|
2 |
|
3 | Storybook for React is a UI development environment for your React components.
|
4 | With it, you can visualize different states of your UI components and develop them interactively.
|
5 |
|
6 | ![Storybook Screenshot](https://github.com/storybookjs/storybook/blob/main/media/storybook-intro.gif)
|
7 |
|
8 | Storybook runs outside of your app.
|
9 | So you can develop UI components in isolation without worrying about app specific dependencies and requirements.
|
10 |
|
11 | ## Getting Started
|
12 |
|
13 | ```sh
|
14 | cd my-react-app
|
15 | npx sb init
|
16 | ```
|
17 |
|
18 | For more information visit: [storybook.js.org](https://storybook.js.org)
|
19 |
|
20 | ---
|
21 |
|
22 | Storybook also comes with a lot of [addons](https://storybook.js.org/addons) and a great API to customize as you wish.
|
23 | You can also build a [static version](https://storybook.js.org/docs/react/sharing/publish-storybook) of your Storybook and deploy it anywhere you want.
|
24 |
|
25 | Here are some featured storybooks that you can reference to see how Storybook works:
|
26 |
|
27 | - [Demo of Storybook Design System](https://storybook.js.org/design-system) - [source](https://github.com/storybookjs/design-system)
|
28 |
|
29 | ## Create React App
|
30 |
|
31 | Support for [Create React App](https://create-react-app.dev/) is handled by [`@storybook/preset-create-react-app`](https://github.com/storybookjs/presets/tree/master/packages/preset-create-react-app).
|
32 |
|
33 | This preset enables support for all Create React App features, including Sass/SCSS and TypeScript.
|
34 |
|
35 | If you're working on an app that was initialized manually (i.e., without the use of Create React App), ensure that your app has [react-dom](https://www.npmjs.com/package/react-dom) included as a dependency. Failing to do so can lead to unforeseen issues with Storybook and your project.
|
36 |
|
37 | ## Typescript
|
38 |
|
39 | `@storybook/react` is now exporting its own types to use with Typescript.
|
40 | You don't need to have `@types/storybook__react` installed anymore if it was your case.
|
41 | But you probably also need to use types from `@types/node @types/react`.
|
42 |
|
43 | ## Docs
|
44 |
|
45 | - [Basics](https://storybook.js.org/docs/react/get-started/introduction)
|
46 | - [Configurations](https://storybook.js.org/docs/react/configure/overview)
|
47 | - [Addons](https://storybook.js.org/docs/react/configure/storybook-addons)
|