Switch

Switch

A switch component that allows users to toggle between two states.


Switch is Disabled

Installation

npx react-nex add Switch

Example

Disabled Switch

Switch is Disabled


Props

enabled

  • Type: boolean
  • Description: Controls whether the switch is enabled or disabled.

onChange

  • Type: (state: boolean) => void
  • Description: Callback function that is called when the switch is toggled. The new state is passed as a boolean.

disabled

  • Type: boolean
  • Description: If true, the switch is not clickable and appears in a disabled state.