Skip to main content

Checkbox

Select an independent option.

Checkbox in a native Kindle example

Usage​

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

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

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

return (
<View style={{padding: 24, flexDirection: 'row', alignItems: 'center'}}>
<Checkbox value={enabled} onValueChange={setEnabled}
accessibilityLabel="Include archived books"
style={{width: 44, height: 44, marginRight: 16}} />
<Text>Include archived books</Text>
</View>
);
}

Props​

PropType / defaultDescription
valueboolean = falseCurrent selection.
onValueChange(value: boolean) => voidUpdate your state with the new selection.
disabledboolean = falsePrevents changes.
styleView styleSet width and height.
accessibilityLabelstringSpoken label.

The screenshot includes both checkbox and switch states. Supply a visible text label separately. Set disabled to show an unavailable option.