Skip to main content

Button

Run an action when pressed. Use a primary button for the main action and a secondary button for alternatives.

Button in a native Kindle example

Usage​

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

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

export default function App() {
const [saved, setSaved] = useState(false);

return (
<View style={{padding: 24}}>
<Text>{saved ? 'Saved' : 'Ready to save'}</Text>
<Button onPress={() => setSaved(true)}>Save</Button>
<Button variant="secondary" onPress={() => setSaved(false)}>Reset</Button>
<Button disabled>Unavailable</Button>
</View>
);
}

Props​

PropType / defaultDescription
childrenstringButton label.
variantprimary (default) / secondaryVisual emphasis.
disabledboolean = falseIgnores presses and uses disabled colors.
onPressfunctionRuns on click.
onPressIn / onPressOutfunctionPress and release callbacks.
onLongPressfunctionA handled long press suppresses the next click.
feedbackinvert (default) / nonePress feedback.
styleView stylePlacement and margins.

The component sets its own colors, border, padding, and label styling. Its base height is 56 and minimum width is 112. Height and label size follow the font scale.