Skip to content

Switch

Overview

Switches toggle between two states, typically representing on and off.

switch gif

Properties

namedescriptiontypedefault
valueRequired. Current state of the switch.boolean-
onSwitchRequired. Callback when the state changes.(value: boolean) => void-
labelEndContent displayed at the end of the label.ReactNode-
labelStartContent displayed at the start of the label.ReactNode-
handleIconIcon for the handle.ReactNode-
hideIconOnSwitchOffHides the icon when the switch is off.booleantrue
handleActiveBorderColorBorder color when the handle is active.ColorValue-
handleInactiveBorderColorBorder color when the handle is inactive.ColorValue-
handleActiveBackgroundColorBackground color when the handle is active.ColorValue-
handleInactiveBackgroundColorBackground color when the handle is inactive.ColorValue-
trackActiveBorderColorBorder color when the track is active.ColorValue-
trackInactiveBorderColorBorder color when the track is inactive.ColorValue-
trackActiveBackgroundColorBackground color when the track is active.ColorValue-
trackInactiveBackgroundColorBackground color when the track is inactive.ColorValue-
styleCustom styles for the switch container.ViewStyle-
hanldeStyleCustom styles for the handle.ViewStyle-
trackStyleCustom styles for the track.ViewStyle-
animationDurationDuration of the toggle animation in milliseconds.number220