Skip to main content
Version: Next

Button

The Button component is a customizable button that can display either a label or an icon, or both. It is built using the Pressable component from react-native and allows for various states like focused and disabled.

Import

import { Button } from "@tra-tech/react-native-kitra";    

Usage

import { Button, Icon } from '@tra-tech/react-native-kitra';
import { View } from 'react-native';

const App = () => (
<View style={{ flexDirection: 'column', alignItems: 'center' }}>
<Button
size="medium"
iconPosition="left"
label="Press Me!"
style={{ alignSelf: 'center', marginBottom: 10 }}
onPress={()=>console.log('pressed')}>
<Icon type="material-community" size={20} name="penguin" />
</Button>
</View>
);

export default App;


Props

PropTypeRequiredDescription
size'small' | 'medium' | 'large'NoThe size of the button. Default value: 'medium'.
disabledbooleanNoDetermines whether the button is disabled. Default value: false.
labelstringNoThe label to display on the button.
iconPosition'left' | 'right'NoThe position of the icon in relation to the label. Default value: 'left'.
styleStyleProp<ViewStyle>NoThe style object for the button.
labelStyleStyleProp<TextStyle>NoThe style object for the button's text.
childrenReact.ReactNodeNoIcons to be rendered inside the button.
statusStyleActionPropsNoContains style definitions for a button component's normal, focused, and disabled states, specifying background and text colors.
themeUIThemeNoThe theme to use for the component.
typographyUITypographyNoThe typography to use for the component.
...PressablePropsPressableNoAny additional props to be passed to the underlying Pressable component.

Types

NameType
ActionProps { default:{container: {backgroundColor: string},text: {color: string}},
focused: {container: {backgroundColor: string},text: {color: string}},
disabled: {container: { backgroundColor: string},text:{color:string}}}