UI Launch Docs

Switch

A toggle component from the UILaunch design system. Used to represent binary states such as on/off or enabled/disabled, with optional labels.

🕹️ Switch Component

The Switch component is used to toggle between two states (on/off). It supports animated transitions, disabled state, and optional labels for each state. Useful in settings, preferences, or binary input scenarios.

Switch Component

📦 Import

import Switch from '@madefordevs1999/ui-launch-native/system/molecules/Switch';

🧩 Usage

import Switch from '@madefordevs1999/ui-launch-native/system/molecules/Switch';

const [isEnabled, setIsEnabled] = useState(false);

<Switch
  value={isEnabled}
  onValueChange={setIsEnabled}
  activeText="On"
  inactiveText="Off"
/>;

📸 Results

Switch Component

📜 Switch Props

Prop NameTypeDefaultDescription
disabledbooleanfalseIf true, the switch cannot be interacted with.
valuebooleanCurrent value of the switch (controlled).
initialValuebooleanfalseInitial value for the switch if value is not provided.
onValueChange(value: boolean) => voidCallback function when the switch is toggled.
activeTextstringText to display when the switch is active (checked).
inactiveTextstringText to display when the switch is inactive (unchecked).