Skip to main content

Toggle

Toggle | Element allowing to switch between two states shadow

Toggle elements are small interactive controls that allow you to switch between two states. You can activate them with a click of the mouse. They are most often used to activate and deactivate functionalities or to switch between showing and hiding other elements.

Basic Usage

Colors

Attributes and Properties

checked

DescriptionIf true, toggle is activated.
Attributechecked
Typeboolean
Defaultfalse

color

DescriptionThe color to use from your application's color palette. The default options are "primary", "success", "warning", "danger", "complete", and "dark". For more information on colors, visit Customization Basics.
Attributecolor
Type"complete" | "danger" | "dark" | "primary" | "success" | "warning" | string | undefined
Defaultundefined

disabled

DescriptionIf true, the toggle element cannot be interacted with.
Attributedisabled
Typeboolean
Defaultfalse

name

DescriptionDefines a name attribute that is important, for example, when used in forms.
Attributename
Typestring
Defaultthis.inputId

Events

NameDescription
changeInvoked when the state of the element changes.

Methods

No public methods available for this component.

CSS Shadow Parts

NameDescription
inputRefers to an input element of type checkbox
toggleRefers to the inner div wrapping element

CSS Custom Properties

NameDescription
--wj-toggle-border-radiusBorder radius of the toggle track
--wj-toggle-color-baseBackground of the toggle handle
--wj-toggle-handle-border-radiusBackground of the toggle handle when checked
--wj-toggle-handle-colorBorder radius of the toggle handle
--wj-toggle-handle-heightBox shadow of the toggle handle
--wj-toggle-handle-shadowHeight of the toggle handle
--wj-toggle-handle-shadow-checkedMaximum height of the toggle handle
--wj-toggle-handle-widthHorizontal spacing around the toggle handle
--wj-toggle-heightTransition of the toggle handle
--wj-toggle-widthWidth of the toggle handle

Slots

NameDescription
``Default location of the element content.