HTML reference
is
The is attribute is used with customized built-in elements: a standard HTML element keeps its native semantics while JavaScript adds custom behavior.
What you will learn
- What
ismeans for customized built-in elements - Why native semantics and keyboard behavior matter
- Why support testing and a fallback are important
Conceptual example
<button is="fancy-button" type="button">
Save
</button>JavaScript can define a custom element named fancy-button that extends the built-in HTMLButtonElement. The original button semantics should remain intact.
What to preserve
- Keep the native element's correct role, keyboard behavior, and form behavior.
- Do not replace a semantic button with a generic
divjust to add styling. - Make the enhanced and unenhanced versions usable where possible.
Compatibility and design
Customized built-in elements have uneven support across browsers and environments. Check current compatibility data for your audience before relying on is, and provide a progressive-enhancement or simpler fallback when the custom behavior is unavailable.