Traken UI

ToggleSwitch

A customizable switch for toggling between two states (on/off), with options for size, color, and optional labels.


Sizes


Colors


Features

  • Toggle between two states: on and off
  • Customizable size and color to match the design requirements
  • Optional labels for the on and off states
  • Simple onChange handler for state management

Props

PropTypeDefaultDescription
checkedbooleanfalseDefines whether the switch is in the "on" state (true) or "off" state (false).
onChange(checked: boolean) => voidCallback function that is triggered when the switch state changes. It receives the new state (true or false).
size`"sm""md""lg"
color`"base""primary""secondary"
onTextstring""The text to display when the switch is in the "on" state.
offTexttstring

On this page