storybook compinente code example

Example 1: storybook init

npm run storybook

Example 2: storybook

npx sb init

Storybook needs to be installed into a project that is already setup with a framework. It will not work on an empty project. There are many ways to bootstrap an app in given framework including:

 Create React App
 Vue CLI
Or any other tooling available.
During its install process, Storybook will look into your project's dependencies and provide you with the best configuration available.

The command above will make the following changes to your local environment:
Install the required dependencies.
Setup the necessary scripts to run and build Storybook.
Add the default Storybook configuration.
Add some boilerplate stories to get you started.
Check that everything worked by running:

npm run storybook

Tags:

Misc Example