← Back to release summary

CSS toggles

Category
CSS
Type
New or changed feature
Status
No longer pursuing (Chrome No longer pursuing)
Intent stage
None

WPT details: https://wpt.fyi/results/css/css-toggle?label=experimental&label=master

Summary

CSS toggles are a mechanism for associating toggleable state with a DOM element. This state can be defined and connected to activations through CSS properties, and can be queried in CSS selectors. This provides a declarative mechanism for specifying state that describes behaviors like the existing HTML behaviors for checkboxes or radio buttons.

Motivation

There are many cases where a user interaction (such as a click) toggles state that styles depend on. These cases include popups, tabs, carousels, accordions, and toggles controlling light/dark mode. Building these today requires Javascript. We would like to build a declarative way of doing this that, if we do it right, will be easier for developers to use, faster, and more accessible than the solutions that are used today.

Standards & signals

Ecosystem

Explainers: https://css.oddbird.net/toggles/explainer/

View on chromestatus.com