Form-associated custom element
A form-associated custom element is a custom HTML element that participates in form association, submission, validation, reset, and state-restoration behavior.
Vanilla Web
A form-associated custom element is a custom HTML element that participates in a form's association, disabled-state, reset, and state-restoration behavior.
- How it is used
- Makes custom fields participate in form submission, validation, labels, resets, and disabled-state changes.
- How deep it goes
- Works through setup, value synchronization, validation methods, lifecycle callbacks, and submission tests.
- Examples
- Uses a required custom text field, a FormData submission test, and a checkout form with custom fields and a submit button.
- What you can do after
- Build it from scratch with ElementInternals, then test submitted values and validation behavior.
Read how Vanilla Web explains form-associated custom element →
Web Component Development with Modern Libraries and Tooling
A custom element integrated with an HTML form so it can participate in form submission and reset behavior.
- How it is used
- Enables custom elements inside HTML forms to submit data and participate in reset behavior.
- How deep it goes
- Explains class declaration, ElementInternals, submitted values, and reset callbacks, but leaves callback state implementation unspecified.
- Examples
- Uses a temperature-gauge name attribute and FormData entries named color and size to demonstrate submitted values.
- What you can do after
- Build it from scratch by registering form association, setting submitted values, and restoring component state on reset.
Related concepts
- Custom Elementskind of · A custom element is an author-defined HTML element that represents application-specific content or behavior beyond that of built-in HTML elements.
- formAssociatedconfigured by · formAssociated is a static Boolean property on a custom-element class that declares whether its elements can participate in HTML form behavior.
- form submissionuses · Form submission is the process by which a browser sends the values of a web form to a destination for processing.
- formResetCallbackuses · formResetCallback is a form-associated custom-element lifecycle callback invoked when the element’s associated HTML form is reset.
Questions about form-associated custom element
What is form-associated custom element?
A form-associated custom element is a custom HTML element that participates in form association, submission, validation, reset, and state-restoration behavior.
Which Manning books explain form-associated custom element?
Vanilla Web and Web Component Development with Modern Libraries and Tooling.
What is the difference between form-associated custom element and custom widget?
A form-associated custom element is a custom HTML element that participates in form association, submission, validation, reset, and state-restoration behavior. A custom widget is a developer-created interactive interface component that is not provided as a native HTML control.
What is form-associated custom element a kind of?
Form-associated custom element is a kind of Custom Elements. A custom element is an author-defined HTML element that represents application-specific content or behavior beyond that of built-in HTML elements.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

