Lit helps you author standards-based web components with reactive properties, scoped styles, and declarative HTML templates.
Overview
Lit is a JavaScript library centered on building custom elements that run in the browser. Its base classes add reactive state, shadow DOM scoped CSS, and an HTML template layer designed to stay small on the wire.
Components are ordinary custom elements, so they can render inside hand-written pages, CMS output, or various frameworks. The template system uses tagged template literals with inline JavaScript expressions, and property or attribute changes trigger efficient updates that touch only dynamic parts of the DOM.
The published npm packages include the main lit bundle, lit-element, lit-html, and lower-level reactive-element primitives. Additional modules cover localization, React wrappers, async task controllers, routers, motion directives, testing helpers, and experimental server-side rendering tools in the labs namespace.
Documentation and interactive examples live on lit.dev, with starter templates for JavaScript and TypeScript component projects.
Key features
- Custom element base classes
- Reactive properties and attributes
- Shadow DOM scoped styling
- lit-html declarative templates
- Small minified bundle size
- Localization tooling package
- React wrapper for components
- SSR and virtualization labs
Use cases
- Build shareable design system components
- Embed widgets in any HTML page
- Progressively enhance static sites
- Ship framework-agnostic UI primitives