HTML is Global Attribute
The is attribute turns a built-in element, such as a button, into a customized built-in element defined in JavaScript. Safari does not support it.
Description
The is global attribute makes a standard HTML element behave like a customized built-in element: a custom element that extends a built-in element such as <button> or <ul> instead of the generic HTMLElement.
The element keeps all the behavior, accessibility and form features of the built-in element, and adds the behavior defined in JavaScript. The custom element must be registered with customElements.define() using the extends option, and its class must extend the matching interface:
class FancyButton extends HTMLButtonElement {
connectedCallback() {
this.addEventListener("click", () => this.classList.toggle("on"));
}
}
customElements.define("fancy-button", FancyButton, { extends: "button" });
<button is="fancy-button">Toggle me</button>
The value must be the name of the custom element, which has to contain a hyphen. Safari does not support customized built-in elements and has no plans to, so a polyfill is needed there; autonomous custom elements (<fancy-button>) work in all browsers.
Syntax
<element is="custom-element-name">
Values
- custom-element-nameThe name of a customized built-in element registered with
customElements.define()and theextendsoption. It must contain a hyphen.
Example
Browser Support
The following information will show you the current browser support for the HTML is global attribute. Hover over a browser icon to see the version that first introduced support for this HTML global attribute.
Desktop





Tablets & Mobile





