Authoring Components With Stencil

Learn how to create a new Stencil project, the file structure of a Web Component, and component lifecycle hooks.

Getting started

We run the following command to create a new Stencil project:

npm init stencil

We will then be presented with the following options to select the type of project we wish to create:

  • The app option
  • The component option

The prompts should be reasonably self-explanatory, but for this chapter, make sure to select the component option.

Note: Try running this command in the terminal provided below! Answer the prompts as directed and give our project a suitable name.

Get hands-on with 1200+ tech skills courses.