The feature lets custom elements expose their states via the :state() CSS pseudo class.

Motivation

Built-in elements have certain “states” that can change over time depending on user interaction and other factors, and are exposed to web authors through pseudo classes. For example, some form controls have the “invalid” state, which is exposed through the :invalid pseudo class. Like built-in elements, custom elements may also have states, and web authors want to expose these states in a similar fashion to the built-in elements.

Documentation

Specification

Public discussion

Status in Chromium

Blink>HTML>CustomElements


Enabled by default (tracking bug) in:

  • Chrome for desktop release 90
  • Chrome for Android release 90
  • Android WebView release 90

Consensus & Standardization

After a feature ships in Chrome, the values listed here are not guaranteed to be up to date.

  • No signal
  • No signal
  • No signal
  • Positive

Owners

Intent to Prototype url

Intent to Prototype thread

Search tags

custom element, custom state,

Last updated on 2021-04-21