NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
npm · #3682 most downloaded on npm
HTML templates literals in JavaScript
Last release 4 months ago
14 May 2026
Ships fairly regularly
a new release about every 2 months
Nearly every release is documented
notes for 58 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
9 years old
107 releases · first in 2017
### Minor Changes - #4755 `25962bf5` Thanks @kyubisation! - Implement SSR event handling and an optional flag globalThis.litSsrCallConnectedCallback t
25962bf5 Thanks @kyubisation! - Implement SSR event handling and an optional flag globalThis.litSsrCallConnectedCallback to call connectedCallback during SSR, if set to true.shadyTemplateFactory from lib/shady-render.js (#1135)One column per quarter.
Nothing published for this version
### Patch Changes - #4553 `65bc240c` Thanks @kyubisation! - Implement Element.localName and Element.tagName. Fixes 3375.
65bc240c Thanks @kyubisation! - Implement Element.localName and Element.tagName. Fixes 3375.### Minor Changes - #4493 `e901c582` - Add toggleAttribute to the Element shim.
#3885 7932f7dd - @lit-labs/ssr-react and @lit-labs/react now coordinate prop handling during server rendering and hydration.
@lit-labs/ssr-react will call setAttribute() with all props provided during server rendering unless they are provided in <code>_$litProps$</code> object made by @lit-labs/react. Previously, it would call setProperty() for props that were found in the element's prototype, and setAttribute() for those that weren't. If you wish to server render custom elements that take properties that can not be set as attributes (i.e. not serializeable or have different name as attribute/property), you must use @lit-labs/react to create a React wrapper component.@lit-labs/react now has a Node build and export condition to do special prop handling during server rendering. It detects the presence of React.createElement monkey patch by @lit-labs/ssr-react and provides props to be set as properties to the createElement() call.@lit-labs/ssr-react will add the defer-hydration attribute to custom elements that had properties set so that @lit-labs/react wrapped elements have a chance to set properties on the element before Lit element hydration is triggered.@lit-labs/react wrapped components will suppress hydration warnings raised by React due to server rendered attributes.unsafeSVG directive to bind SVG source inside SVGs. (#304)templateContent() directive for stamping out the contents of an HTML template into a text binding. (#1058)live() directive. (#877)Nothing published for this version
### Patch Changes - #4598 `7cfb2274` Thanks @jun-sheaf! - Use target.set instead of member assignment in @consume() decorator.
7cfb2274 Thanks @jun-sheaf! - Use target.set instead of member assignment in @consume() decorator.### Patch Changes - #4903 `6a232e92` - Add Lit Labs noticed to README
render and shady-render now both accept any value that is renderable by NodePart. (#910)Updated dependencies \[`feccc1ba`, `290a608a`]:
62df19da Thanks @autopulated! - ContextProvider can now be added to any HTML elements, not just custom elements implementing a ReactiveControllerHost.__ prefix (#859).shady-render (#760).Nothing published for this version
### Major Changes - #4170 `04c8d65a` - Graduate @lit-labs/task to @lit/task, its permanent location. @lit-labs/task is now just a proxy for @lit/task,
@lit/reactive-element is a new package that factors out the base class that provides the reactive update lifecycle based on property/attribute changes to LitElement (what was previously called UpdatingElement) into a separate package. LitElement now extends ReactiveElement to add lit-html rendering via the render() callback. See ReactiveElement API for more details.UpdatingElement has been renamed to ReactiveElement.updating-element package has been renamed to @lit/reactive-element.@internalProperty decorator has been renamed to @state._getUpdateComplete to getUpdateComplete.reflect: true and its toAttribute function returns undefined the attribute is now removed where previously it was left unchanged (#872).unhandledrejection event handler on window.renderRoot is now created when the element's connectedCallback is initially run.requestUpdateInternal. The requestUpdate method is now identical to this method and should be used instead.initialize method has been removed. This work is now done in the element constructor.static addInitializer for adding a function which is called with the element instance when is created. This can be used, for example, to create decorators which hook into element lifecycle by creating a reactive controller (#1663).connectedCallback, disconnectedCallback, willUpdate, update, and updated. To ensure it has access to the element lifecycle, a controller should be added in the element's constructor. To add a controller to the element, call addController(controller).removeController(controller) which can be used to remove a controller from a ReactiveElement.willUpdate(changedProperties) lifecycle method to UpdatingElement. This is called before the update method and can be used to compute derived state needed for updating. This method is intended to be called during server side rendering and should not manipulate element DOM.lit-html on window (#790).any outside of test code (#741).Performance improvements to template processing.
Fixed typing for template_polyfill createElement call.
createElement call.Nothing published for this version
until() can now take any number of sync or async arguments.
until() can now take any number of sync or async arguments. (#555)guard() supports multiple dependencies. If the first argument to guard() is an array, the array items are checked for equality to previous values. (#666)classMap.js and styleMap.js files to kebab-case. (#644)cache() directive. (#646)<template> polyfill.when() directive. Users may achieve similar behavior by wrapping a ternary with the cache() directive.### Minor Changes - #4682 `290a608a` - Update typescript to 5.5.0
directive(). (#562)eventContext is no longer used as the this value for event listener objects (object with a handleEvent method), as the object itself is supposed to be the this value. (#576)### Minor Changes - #4261 `1b17a369` - Add lib/lit-html/template.js module with initial template utilities.
render() now takes an options object as the third argument. (#523)this reference, which is set via the eventContext option to render(). (#523)Fixed issues with shady-render introduced in 0.11.3 (#504 and #505).
Moved upgrading of custom elements in template fragments to a common location in TemplateInstance
Added classMap and styleMap directives
### Patch Changes - #4520 `89c5bdfb` - Update typescript dependency
### Minor Changes - #4322 `2896209b` - Remove dependencies on Node-specific libaries. This change requries passing a path separator to absoluteToPacka
directives/ directory (#436)PartCallback with TemplateProcessor (#405)NodePart and AttributePart interfaces (#400)
Part has separate setValue() and commit() phasesAttributeCommitter to commit attribute values once for multiple AttributePartsviewBox correctly (#376)<template> elements (#343)Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Added noChange - Value in favour of directiveValue (deprecated).
noChange - Value in favour of directiveValue (deprecated).
noChange - Value signals that a value was handled by a directive and should not be written to the DOM@apply, and work in browers where CSS Custom Properties must be polyfilled, like IE 11.insertNodeIntoTemplate(template: Template, node: Node, refNode: Node|null)removeNodesFromTemplate(template: Template, nodesToRemove: Set<Node>)### Minor Changes - #4141 `6b515e43` - Update TypeScript to ~5.2.0 ### Patch Changes - #4252 `c0195cba` Thanks @43081j! - Always use consumer's typesc
### Minor Changes - #4030 `55bfed2f` - Upgrade TypeScript to ~5.0 - #3980 `91611d73` - Add separate entrypoint for createPackageAnalyzer() which requi
render() are implemented so that all
specialization of template syntax is done in tags, not render(), allowing
for the mixing-in of templates of different syntaxes, and for hooks in
render() to change templates before they're initially processed.prepareTemplate() function to process style
tags and elements in the template for emulate CSS scoping.? suffix on the name now act as boolean
attributes. The attribute will be removed for falsey values and set to '' for
truthy values, matching the HTML specification behavior for boolean attributes.Updated dependencies \[`feccc1ba`]:
d8e80656 - The analyzer no longer crashes in many cases when encountering code with unexpected syntax or cases that the analyzer does not yet handle. The custom elements manifest generator also logs diagnostics collected while generating the manifest, but generates the manifest whenever possible.(foo)= and [foo]= names.repeat directive.repeat directive.asyncAppend and asyncReplace directives to handle async iterable values in expressions.Nothing published for this version
### Patch Changes - #4299 `fffa4406` - Update version range for lit dependency to include v2 (and/or @lit/reactive-element v1). This allows projects s
### Minor Changes - #4141 `6b515e43` - Update TypeScript to ~5.2.0, which includes breaking changes to the TypeScript compiler APIs ### Patch Changes
svg template tag for creating partial SVG contentUpdated dependencies \[`9001f9c1`, `55bfed2f`, `91611d73`, `da6646d8`]:
undefined.unsafeHTML() directive to bind values as HTML source.render().directive() decorator function to create directives. Functions values are no longer treated as directive by default, simplifying declarative event handlers.Nothing published for this version
Nothing published for this version
Nothing published for this version
### Minor Changes - #4151 `5680d483` - Make context decorators work with standard decorators ### Patch Changes - #4210 `cf7d96d4` - Graduate @lit-labs
#4210 cf7d96d4 - Graduate @lit-labs/context to @lit/context, its permanent location. @lit-labs/context is now just a proxy for @lit/context, so code need not be duplicated in projects that depend on both.
#4200 8e737fbd - Support @provide with experimental decorators on a property. Previously we only supported it on an accessor, which happened automatically if used with @state or @property.
d8e80656 - The analyzer no longer crashes in many cases when encountering code with unexpected syntax or cases that the analyzer does not yet handle. The custom elements manifest generator also logs diagnostics collected while generating the manifest, but generates the manifest whenever possible.d8e80656]:
Updated dependencies \[`290a608a`]:
The monkey-patching logic also adds a workaround for inconsistent es module interop behavior in tools like webpack which could lead to errors like Typ
#4575 aa4fc3ef - The Node build of @lit-labs/ssr-react/enable-lit-ssr.js now also monkey-patches react/jsx-runtime to include logic for deeply server-rendering Lit components without modifying jsxImportSource in tsconfig.
The monkey-patching logic also adds a workaround for inconsistent es module interop behavior in tools like webpack which could lead to errors like TypeError: Cannot set property createElement of [object Module] which has only a getter.
3e54ba22b24bdd6f5e29e74534aeab65d08c669e Thanks @malobre! - export SignalWatcherApi interface which is used in the return type of the SignalWatcher mixinUpdated dependencies \[`25962bf5`]:
#4821 f93f51be Thanks @kyubisation! - Fix fixture base url resolution when running browsers in containers
#4730 267d243a Thanks @kyubisation! - Add option for init script for ssr worker to allow registering Node.js hooks
Updated dependencies [25962bf5]:
### Patch Changes - #4731 `ff87eb46` Thanks @kyubisation! - Add fallback for call site location detection for webkit
ff87eb46 Thanks @kyubisation! - Add fallback for call site location detection for webkit28c33d23 Thanks @bennypowers! - Includes TypeScript typings and source maps in npm tarball, corrects main package.json fieldd8e80656]:
webpackModuleRulesTest accepts a RegExp that will match modules where Lit SSR support will be injected. Ideally it should match entrypoint to your rou
#4993 a33d6792 Thanks @ADNolan! - Prevent duplicative patching of React.createElement.
#4960 6a72c869 Thanks @fernandofranca! - Add additional options for configuring webpack rules:
webpackModuleRulesTest accepts a RegExp that will match modules where Lit SSR support will be injected. Ideally it should match entrypoint to your routes. This used to be internally set as, and now defaults to, /\/pages\/.*\.(?:j\|t)sx?$\|\/app\/.*\.(?:j\|t)sx?$/.webpackModuleRulesExclude accepts an array of RegExp to exclude from any modules selected with above option. This used to be internally set as, and now defaults to, [/next\/dist\//, /node_modules/].4cf588b0 Thanks @bennypowers! - Initial pre-release2c59ceb9]:
### Patch Changes - #4940 `b42e0465` Thanks @raoufswe! - [Changed] - update webpack exclude to filter node_modules
d8e80656]:
### Patch Changes - #4311 `cabe72a8` - Removed lit package from dependency. It is now listed as a dev dependency since it is only used for testing.
2c59ceb9]:
### Patch Changes - #4840 `37c02502` Thanks @kyubisation! - Fix type of nextjs config wrapper - #4815 `d3ce79a7` Thanks @JamesIves! - Adds support for
#4840 37c02502 Thanks @kyubisation! - Fix type of nextjs config wrapper
#4815 d3ce79a7 Thanks @JamesIves! - Adds support for Next.js 15
290a608a]:
### Minor Changes - #5208 `fb64afc2fbe5d086d1586feaf1a9b9646e5aaccd` Thanks @bencbradshaw! - feat: replace clean-css with lightningcss for CSS minific
fb64afc2fbe5d086d1586feaf1a9b9646e5aaccd Thanks @bencbradshaw! - feat: replace clean-css with lightningcss for CSS minification#4575 aa4fc3ef - Add support for Next.js 14 and App Router. No longer support Next.js 12.
Note: By default, components in the App Router are React Server Components (RSCs). Deep SSR of Lit components does not work within server components as they result in React hydration mismatch due to the presence of the <template> element in the RSC payload containing the serialized server component tree, and the custom element definitions will not be included with the client bundle either when imported in server component files.
Make sure any Lit components you wish to use are beyond the 'use client'; boundary. These will still be server rendered for the initial page load just like they did for the Pages Router.
#3885 7932f7dd - @lit-labs/ssr-react and @lit-labs/react now coordinate prop handling during server rendering and hydration.
@lit-labs/ssr-react will call setAttribute() with all props provided during server rendering unless they are provided in <code>_$litProps$</code> object made by @lit-labs/react. Previously, it would call setProperty() for props that were found in the element's prototype, and setAttribute() for those that weren't. If you wish to server render custom elements that take properties that can not be set as attributes (i.e. not serializeable or have different name as attribute/property), you must use @lit-labs/react to create a React wrapper component.@lit-labs/react now has a Node build and export condition to do special prop handling during server rendering. It detects the presence of React.createElement monkey patch by @lit-labs/ssr-react and provides props to be set as properties to the createElement() call.@lit-labs/ssr-react will add the defer-hydration attribute to custom elements that had properties set so that @lit-labs/react wrapped elements have a chance to set properties on the element before Lit element hydration is triggered.@lit-labs/react wrapped components will suppress hydration warnings raised by React due to server rendered attributes.Add rollup 4 as a supported peerDependency
b83b3e6e Thanks @bencbradshaw! - - Combine rollup-plugin-minify-html-literals, minify-html-literals, and parse-literals into a single package
Your coding agent can read these notes before it upgrades. Set up the MCP server →