Angular + Storybook + Chromatic Setup

Nishmitha
2 min readDec 24, 2023

--

Angular + Storybook + Chromatic

Revolutionize your Angular development workflow with the dynamic duo of Storybook and Chromatic. In this guide, we’ll dive into the seamless integration of these tools, empowering you to create, test, and iterate on UI components with unparalleled efficiency.

Refer: https://gitlab.com/nishmithas/angular-storybook

Setting up Angular

  • Install the CLI using the npm package manager.
npm install -g @angular/cli
  • Create a new angular project.
ng new <your-project-name>

Setting up Storybook

Use the Storybook CLI to install it in a single command. Run this inside your existing project’s root directory.

cd <your-project-name>/
npx storybook@latest init

Setting up Chromatic

  • Sign up with your GitHub, GitLab, Bitbucket, or email and generate a unique <project-token> for your Storybook.
  • Install the chromatic CLI package from npm.
npm install chromatic --save-dev
  • Run the following command after the package finishes installing. This command will publish your storybook to Chromatic. Ensure that your first publish is from the main branch of your repository.
git checkout main
npx chromatic --project-token <your-project-token>
  • Check out a new branch and make a few changes to the component file. Run the publish command again to view the changes in chromatic.
git checkout -b version-0.1
npx chromatic --project-token <your-project-token>

Embrace the power of Storybook and Chromatic to unlock a new era of Angular development — where efficiency meets excellence, and collaboration thrives in every component. Happy coding!

--

--