react-native-switchery

React Native Switchery

npm version GitHub iOS support Android support

React Native Switchery is an iOS-inspired switch for React Native that is fully available on both iOS and Android. This short guide pulls the key details from the main README so you can see the API, and demos without digging.

Demo

Switchery demo

Installation

npm install react-native-switchery
# or
yarn add react-native-switchery

Usage

import React from 'react';
import { Switch } from 'react-native-switchery';

export const Demo = () => {
  const [value, setValue] = React.useState(false);

  return (
    <Switch
      value={value}
      onValueChange={setValue}
      variant="info"
      size="small"
    />
  );
};

Props (summary)

Prop Description
value Current boolean value.
onValueChange Callback invoked when toggled.
variant Built-in palette: primary, info, success, warning, danger.
size mini, small, default, or large.
activeColor / inactiveColor / thumbColor Override colors individually.
trackBorderColor / trackBorderWidth Customize track outline.
thumbBorderColor / thumbBorderWidth Customize thumb outline.
disabled Disables interaction and shows overlay.
testID, accessibilityLabel, accessibilityHint Testing and accessibility helpers.