Skip to content

Switch

The switch component is an UI element designed to allow users to toggle between two states, such as on/off or enabled/disabled. Its visual and intuitive representation of state changes makes it well-suited for settings, preferences and simillar dual options.

Example

Below is an example of the switch component.

Props

PropertyTypeDefaultDescription
visiblebooleantrueControls the switch's visibility. When true, the switch is visible; when false, it is hidden.
sizeenum (small, medium, large, extra-large)mediumSets the switch's size, adjusting padding, font size, and layout compactness accordingly.
positionnumber[]0 0 0Specifies the switch's position.
primarystring (blue, #fff)#00BA92Defines the primary color of the switch (affecting text, background, icon background).
valuebooleanfalseIndicates whether the switch is in the "on" state.
variantstring (light, dark)""Sets the button's color scheme mode, either "light" or "dark," for visual theme consistency.
opacitynumber1Sets switch's opacity.
insetbooleanfalseControls the appearance of the switch. When set to true, the the thumb (toggle handle) is contained within the bar. When false, the thumb extends beyond the bar, creating a larger, overlapping effect.