Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
63 lines (41 sloc) 2.68 KB
title tocTitle description commit
Get started
Get started
Setup Angular Storybook in your development environment

Storybook for Angular tutorial

Storybook runs alongside your app in development mode. It helps you build UI components isolated from the business logic and context of your app. This edition of Learn Storybook is for Angular.

Storybook and your app

Setup Angular Storybook

We’ll need to follow a few steps to get the build process set up in your environment. To start with, we want to use the @angular/cli to setup our build system, and enable Storybook and Jest testing in our created app. Let’s run the following commands:

# Create our application (using less as the style pre processor):
npx -p @angular/cli ng new taskbox --style less
cd taskbox

# Add Storybook:
npx -p @storybook/cli sb init

We can quickly check that the various environments of our application are working properly:

# Run the test runner (Karma) in a terminal (we will add Jest along the way):
yarn test

# Start the component explorer on port 6006:
yarn run storybook

# Run the frontend app proper on port 4200:
yarn start
NOTE: If yarn test throws an error, you may need to install watchman as advised in this issue.

Our three frontend app modalities: automated test (Jest), component development (Storybook), and the app itself.

3 modalities

Depending on what part of the app you’re working on, you may want to run one or more of these simultaneously. Since our current focus is creating a single UI component, we’ll stick with running Storybook.

Reuse CSS

Taskbox reuses design elements from the GraphQL and React Tutorial example app, so we won’t need to write CSS in this tutorial. We’ll simply include the LESS files in our app and import them inside styles.less.

Taskbox UI

If you want to modify the styling, the source LESS files are provided in the GitHub repo.

Add assets

We also need to add the font and icon directories to the assets/ folder. After adding styling and assets, the app will render a bit strangely. That’s OK. We aren’t working on the app right now. We’re starting off with building our first component!

You can’t perform that action at this time.