Skip to content

VSwitch

Props

NameTypeDescription
checkedbooleanThe current checkedness of the element.
connotationEnum:
accent
alert
announcement
success
cta
Indicates the switch's connotation.
default-checkedbooleanThe default checkedness of the element. This value sets the checked property only when the checked property has not been explicitly set.
disabledbooleanSets the element's disabled state. A disabled element will not be included during form submission.
initial-valuestringThe default value of the element. This value sets the value property only when the value property has not been explicitly set.
labelstringIndicates the switch's label.
namestringThe name of the element. This element's value will be surfaced during form submission under the provided name.
readonlybooleanWhen true, the control will be immutable by user interaction. See https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/readonly
requiredbooleanRequire the field to be completed prior to form submission.
valuestringThe current value of the element.

Events

NameEvent TypeDescription
blurFocusEventFires when the element loses focus.
changeCustomEvent<undefined>Emits a custom change event when the checked state changes
clickMouseEventFires when a pointing device button (such as a mouse's primary mouse button) is both pressed and released while the pointer is located inside the element.
focusFocusEventFires when the element receives focus.
inputEventFires when the value of an element has been changed.
keydownKeyboardEventFires when a key is pressed.
keyupKeyboardEventFires when a key is released.

Methods

NameTypeDescription
checkValidity() => booleanReturn the current validity of the element.
reportValidity() => booleanReturn the current validity of the element. If false, fires an invalid event at the element.