Chapter 2. Your first Web Component

This chapter covers

  • The basis for almost every element you use: HTMLElement
  • Extending classes to make your own custom elements
  • Giving your custom elements logic and interactivity
  • Using custom elements after defining them with customElements.define

As I promised in the beginning of this book, we’re going to start small. Luckily, with Web Components, even when we do start small, we can still make something meaningful. After this chapter, you’ll have the know-how to make your first Web Component and be able to view it right in your browser! Subsequent chapters through this book will explore key concepts in more detail, but the basics start here. At the end of this chapter, we’ll discuss options when your browser ...

Get Web Components in Action now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.