Outline updated November 2026
Professional Web Components with Lit
Class Duration
21 hours of live training delivered over 3 days.
Student Prerequisites
- Experience building Web Components with Custom Elements and Shadow DOM, or completion of Introduction to Web Components
- Experience with modern JavaScript and TypeScript
- Experience with web browser programming
Target Audience
Front-end engineers, design system teams, and component library authors who know the Web Components standards and want to ship components with Lit. Newcomers to the platform should start with Introduction to Web Components.
Description
This advanced course is for teams building component libraries and design systems with Lit. Students start with Lit's component model, its reactive update cycle, and the template system, including custom and async directives. They share behavior with reactive controllers and mixins, and manage data with @lit/context, @lit/task, and signals. Design-system modules cover component APIs, theming with design tokens, form-associated components, and documentation with Storybook. The course also covers Lit SSR, localization, testing in real browsers, and publishing packages to npm.
Learning Outcomes
- Explain Lit's reactive update cycle and build predictable components.
- Write templates with built-in, custom, and async directives.
- Share behavior with reactive controllers and mixins.
- Manage data flow with
@lit/context,@lit/task, and signals. - Design component APIs with attributes, events, slots, parts, and custom states.
- Build themeable, accessible, form-associated components.
- Document components with the Custom Elements Manifest and Storybook.
- Use Lit components in React, Angular, Vue, and Svelte apps.
- Render Lit components on the server and hydrate them.
- Translate components with
@lit/localize. - Test components in real browsers.
- Publish component packages to npm.
Training Materials
Comprehensive courseware is distributed online at the start of class.
Software Requirements
Students will need a free, personal GitHub account to access the courseware. No local student setup is required; this course is delivered with GitHub Codespaces. The free allotment of Codespaces hours from GitHub is sufficient to complete the course.
Software versions: Lit 3 with TypeScript, Vite 8, and Node.js 22.12 or later.
Training Topics
The Lit Component Model
- What Lit adds to the Web Components standards
- Defining components with
LitElement - Reactive properties and internal state
- Attribute converters, reflection, and
hasChanged - Experimental vs. standard decorators
- The
accessorkeyword @queryand@queryAssignedElements
The Reactive Update Cycle
- Batched, asynchronous updates
requestUpdate()andupdateCompletewillUpdate()andupdate()firstUpdated()andupdated()- Computing derived values before render
- Avoiding update loops and unnecessary renders
Lit Templates in Depth
- Expressions, conditionals, and lists
- Efficient lists with
repeat classMapandstyleMapwhen,choose, anduntilref,live,cache, andkeyed- Custom directives
- Async directives
- Static expressions with
lit/static-html
Reactive Controllers
- The
ReactiveControllerinterface - Adding controllers with
addController() - Controllers for observers and timers
- Controllers for keyboard input and fetching
- Composing controllers
- Controllers vs. mixins vs. inheritance
- Controllers compared to React hooks
Composition Patterns
- Component composition and slots
- Compound components and parent-child coordination
- Mixins for cross-cutting behavior
- Events as the public output API
Managing Data
- The Context protocol with
@lit/context @provideand@consumedecorators- Async data with
@lit/task - Experimental signals support for Lit
- State patterns for component libraries
Styling and Theming
- Static styles and shared style modules
- Design tokens as CSS custom properties
- Theming with
::partandexportparts - Custom states with
:state() - Dark mode, high contrast, and reduced motion
Building a Design System
- Designing a component API
- Accessible components with
ElementInternals - Form-associated Lit components
- Focus management and keyboard patterns
- Scoped custom element registries
- Versioning and deprecation policies
Documentation and Framework Integration
- Generating a Custom Elements Manifest
- Documenting components with Storybook
- React wrappers with
@lit/react - Using Web Components in Angular, Vue, and Svelte
- Typed events and properties for framework consumers
Server-Side Rendering with Lit
- How Lit SSR uses Declarative Shadow DOM
- Lit's experimental SSR package
- Hydrating on the client
- DOM emulation and its limits
- Authoring SSR-compatible components
Localization
@lit/localizeruntime and transform modes- Extracting and building translations
Testing Lit Components
- Web Test Runner and Vitest browser mode
- WebdriverIO
- Fixtures and
updateComplete - Shadow DOM queries
- Testing events, slots, and form behavior
- Accessibility checks
- Visual regression testing with Playwright
Publishing and Production
- Library builds with Vite and TypeScript declarations
- Package
exports, side effects, and tree shaking - Unbundled ES modules vs. bundled builds
- Publishing to npm with semantic versioning
- Changelogs
- Lazy loading components in applications
- Performance budgets and bundle analysis