Skip to content

Intro & Custom Elements

Web Components are a suite of browser-native standards that let you define your own HTML elements — reusable, encapsulated, and framework-agnostic. No build step, no library, just the platform.

This course walks you through three interlocking pillars:

flowchart LR
  CE["Custom Elements
(class + define)"]
  SD["Shadow DOM
(encapsulated tree)"]
  TS["Templates & Slots
(declarative markup)"]
  CE --> SD
  SD --> TS
  CE --> TS
The three pillars of Web Components
PillarWhat it gives you
Custom ElementsA class-based API to create new HTML tags
Shadow DOMA private, encapsulated DOM tree and CSS scope
Templates & SlotsReusable HTML fragments with named insertion points

By the end of this module you will have defined your first custom element from scratch, and seen how Lit builds on the same primitives.

The snippet below defines <hello-badge> — a vanilla custom element that reads a name attribute and renders a greeting.

Lit is a thin library that adds reactive properties and a declarative template system on top of the standard Custom Elements and Shadow DOM APIs. It is covered in depth in the Lit and Tooling module — here is a quick taste to confirm the import path works in this runner:

Which browser API lets you register a new HTML tag name?
What are the three pillars of Web Components?
Lit is built on top of which browser-native standards?