Skip to main content

Button

The Button component in our library is a fundamental element for user interaction within applications. Buttons serve as clickable elements that trigger actions or navigate users through different parts of the application. They are versatile and can be styled to match the visual theme of the application, providing consistency in user interface design. With customizable properties such as size, color, and shape, our Button component offers flexibility to suit various design requirements and enhance user experience.

Usage

Basic usage

import React from 'react';
import {Button} from 'rn-inkpad';

const MyComponent = () => {
return <Button />;
};

Props

NameTypeDefaultDescription
activeOpacitynumber0.6Determines what the opacity of the wrapped view should be when touch is active.
buttonColorstring#464EE5Button background color.
buttonType'solid' | 'outline' | 'clear'solidType of button to show.
colorstring#FFFFFFText color.
disabledbooleanTurn pressable on or off.
fullbooleanActive full width.
iconstringIcon to show in the button.
iconPosition'left' | 'right'leftChoose the position in which the icon appears.
iconSizenumberIcon size
loadingbooleanShow a spinner if the button is loading.
roundedbooleanRound borders
spinnerSizenumber | 'small' | 'large'Loading spinner size.
styleStyleProp<ViewStyle>Personalized styles for your button.
textstringButtonButton text
textStyleStyleProp<TextStyle>Personalized styles for your text button.
onPress() => voidFunction that is executed when the button is pressed.

Usage with props

import React from 'react';
import {View} from 'react-native';

import {Button} from 'rn-inkpad';

const MyComponent = () => {
return (
<View>
<Button
text="Green solid button"
icon="alert-circle"
color="#000"
onPress={() => console.log('Press')}
buttonColor="#7EE081"
style={{marginBottom: 10}}
/>
<Button
text="Clear right icon button"
icon="save"
onPress={() => console.log('Press')}
buttonType="clear"
iconPosition="right"
color="#576DEC"
style={{marginBottom: 10}}
/>
<Button
text="Loading button..."
loading
onPress={() => console.log('Press')}
buttonColor="#C3F3C0"
style={{marginBottom: 10}}
/>
<Button
text="Blue outline rounded button"
icon="airplane"
onPress={() => console.log('Press')}
buttonType="outline"
buttonColor="#576DEC"
rounded
/>
</View>
);
};

Example with props