FormAssociated<T>
Convenient interface to implement form-associated custom elements.
See
https://web.dev/articles/more-capable-form-controls
Example
ts
@customElement('text-input')
export class TextInputElement
extends LitElement
implements FormAssociated<string> {}
...
}
Type Parameters
T
T
Properties
disabled?
ts
optional disabled: boolean;
formAssociatedCallback()?
ts
optional formAssociatedCallback: (form: HTMLFormElement) => void;
Parameters
form
HTMLFormElement
Returns
void
formDisabledCallback()?
ts
optional formDisabledCallback: (disabled: boolean) => void;
Parameters
disabled
boolean
Returns
void
formResetCallback()?
ts
optional formResetCallback: () => void;
Returns
void
formStateRestoreCallback()?
ts
optional formStateRestoreCallback: (state: null | string | File | FormData, mode: "autocomplete" | "restore") => void;
Parameters
state
null
| string
| File
| FormData
mode
"autocomplete"
| "restore"
Returns
void
label?
ts
optional label: string;
name?
ts
optional name: string;
readonly?
ts
optional readonly: boolean;
required?
ts
optional required: boolean;
value?
ts
optional value: T;