Skip to main content

SettingsToggle

Turn an option on or off with a rectangular, labeled control. Use Switch for a rounded toggle.

SettingsToggle in a native Kindle example

Usage​

Save this example as apps/Reader/App.js in the starter app.

import React, {useState} from 'react';
import {SettingsToggle, View} from 'react-kindle';

export default function App() {
const [enabled, setEnabled] = useState(true);

return (
<View style={{padding: 24}}>
<SettingsToggle value={enabled} onValueChange={setEnabled} />
</View>
);
}

Props​

PropType / defaultDescription
valueboolean = falseCurrent selection.
onValueChange(value: boolean) => voidSelection callback.
onLabel / offLabelstring = On / OffLabels; supply translated text here.
disabledboolean = falsePrevents changes.
styleView styleLayout overrides.

This control only changes React state. Your app must apply any device setting.