Skip to main content
Version: 1.x

Badge

The Badge is used to place a number or text label in a specific position. It's especially useful for notifications or alerts.

Import

import { Badge } from '@tra-tech/react-native-kitra';

Usage

import { Avatar, Chip, Icon } from '@tra-tech/react-native-kitra';
import { View, StyleSheet } from 'react-native';
import Badge from '../../components/Badge';

const App = () => (
<View style={{ alignItems: 'center', flexDirection: 'row' }}>
<Badge containerStyle={{ margin: 10, backgroundColor: '#9A9A9A' }} borderStyle="rectangular" size="medium" icon={<AntDesign name="apple1" color="#fff" />} />
<Badge containerStyle={{ margin: 10, backgroundColor: '#FF3434' }} borderStyle="rectangular" size="medium" icon={<AntDesign name="android1" color="#fff" />} />
</View>
);

const style = StyleSheet.create({
container: { flex: 1, alignItems: 'center', justifyContent: 'center', rowGap: 20 },
});

export default App;

Props

Prop nameTypeRequiredDescription
visiblebooleanNoVisibility status. Default value: true
label string | number NoThe number or text to be written in the badge.
size 'small' | 'medium'NoThe size of the badge. Default value: 'medium'
containerStyleStyleProp<ViewStyle>NoAdditional styles to apply to the badge container.
labelStyleStyleProp<TextStyle>NoAdditional styles to apply to the children text.
borderStyle'circular' | 'rectangular'NoSpecifies the border type of the badge. Default value: 'circular'
iconReact.ReactNodeNoIcon to be added to badge.
childrenReact.ReactNodeYesA required prop that represents the content to display within the Badge component.
position'top-right'| 'top-left' | 'bottom-left' | 'bottom-right'NoPosition the Badge component. Default value: 'top-right'
themeUITheme NoThe theme to use for the component.
typographyUITypographyNoThe typography to use for the component.