Logo

ToggleButton

Toggle buttons can be used to group related options. To emphasize groups of related toggle buttons, a group should share a common container.

Usage

import * as React from 'react';
import { ToggleButton } from 'react-native-paper';

const ToggleButtonExample = () => {
  const [status, setStatus] = React.useState('checked');

  const onButtonToggle = value => {
    setStatus(status === 'checked' ? 'unchecked' : 'checked');
  };

  return (
    <ToggleButton
      icon="bluetooth"
      value="bluetooth"
      status={status}
      onPress={onButtonToggle}
    />
  );
};

export default ToggleButtonExample;

Props

Type: IconSource

Icon to display for the ToggleButton.

Type: number

Size of the icon.

Type: string

Custom text color for button.

Type: boolean

Whether the button is disabled.

Type: string

Accessibility label for the ToggleButton. This is read by the screen reader when the user taps the button.

Type: (value?: GestureResponderEvent | string) => void

Function to execute on press.

Type: string

Value of button.

Type: 'checked' | 'unchecked'

Status of button.

Type: StyleProp<ViewStyle>
Type: Theme
Edit this page