Switch API

This page provides an overview of the Switch component API, detailing its props, emits, slots, and exposed methods/states.

Props

The Switch component accepts the following props:

PropDefaultTypeDescription
mode"none"SwitchModeThe styling mode of the switch.
rounded99991 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 or number or "full"Rounding of the switch corners.
iconActiveundefinedIconsProps["type"]Icon displayed when the switch is active.
iconInactiveundefinedIconsProps["type"]Icon displayed when the switch is inactive.
switchingType"checkbox""checkbox" or "switch" or stringThe type of switching mechanism.
idundefinedstring or undefinedUnique identifier for the switch component.
modelValueundefinedboolean or null or undefinedThe current value of the switch.
label""string or undefinedThe label displayed next to the switch.
disabledfalseboolean or undefinedDisables the switch if set to true.
helpundefinedstring or undefinedHelp text displayed below the switch.
requiredfalseboolean or undefinedIndicates whether the switch is required.
classundefinedStyleClass or undefinedCustom CSS class for the switch container.

Emits

The Switch component emits the following events:

EmitPayloadDescription
update:modelValuebooleanEmitted when the modelValue is updated.
updateModelValuebooleanAlias for update:modelValue event.
change:modelValuebooleanEmitted when the value of the switch changes.

Slots

The Switch component provides the following slots:

SlotPayloadDescription
defaultVNode[]Default slot for custom content inside the switch component.

Expose

The Switch component exposes the following methods and states via ref:

ExposeValueDescription
idSwitchProps["id"]Unique identifier for the switch component.
modeSwitchProps["mode"]The current styling mode of the switch.
labelSwitchProps["label"]The label displayed next to the switch.
roundedSwitchProps["rounded"]The rounding of the switch corners.
isDisabledSwitchProps["disabled"]Indicates whether the switch is disabled.
isRequiredSwitchProps["required"]Indicates whether the switch is required.
iconActiveSwitchProps["iconActive"]The icon displayed when the switch is active.
iconInactiveSwitchProps["iconInactive"]The icon displayed when the switch is inactive.
switchingTypeSwitchProps["switchingType"]The type of switching mechanism.
classBaseSwitchStyleClassCustom CSS class for the base switch container.
classSwitchStyleClassCustom CSS class for the switch element.

Methods:

  • inputEvent(value: boolean): void - Handles input events for toggling the switch.
© 2025 FishtVue by Egoka