The disabled state of the component
Control the validity of the control.
The label position of the control.
The name attribute of the control.
Makes the control a required field in a form context.
The checked state of the control.
Returns the HTMLFormElement associated with this element.
A string containing the validation message of this element.
Returns a ValidityState object which represents the different validity states the element can be in, with respect to constraint validation.
The value attribute of the control.
A boolean value which returns true if the element is a submittable element that is a candidate for constraint validation.
Invoked when the component is added to the document's DOM.
In connectedCallback()
you should setup tasks that should only occur when
the element is connected to the document. The most common of these is
adding event listeners to nodes external to the element, like a keydown
event handler added to the window.
connectedCallback() {
super.connectedCallback();
addEventListener('keydown', this._handleKeydown);
}
Typically, anything done in connectedCallback()
should be undone when the
element is disconnected, in disconnectedCallback()
.
Similar to a checkbox, a switch controls the state of a single setting on or off.
Element
igc-switch
Slot
Fires
igcChange - Emitted when the control's checked state changes.
Csspart
base - The base wrapper of the switch.
Csspart
control - The switch input element.
Csspart
thumb - The position indicator of the switch.
Csspart
label - The switch label.