Syntax
import React, { Component } from 'react';
import { Container, Content, Badge, Text } from 'native-base';
export default class BadgeExample extends Component {
render() {
return (
<Container>
<Content>
<Badge>
<Text>2</Text>
</Badge>
<Badge primary>
<Text>2</Text>
</Badge>
<Badge success>
<Text>2</Text>
</Badge>
<Badge info>
<Text>2</Text>
</Badge>
<Badge warning>
<Text>2</Text>
</Badge>
<Badge danger>
<Text>2</Text>
</Badge>
<Badge primary>
<Icon name="star" />
</Badge>
<Badge
style={{ backgroundColor: 'black' }}>
<Text style={{ color: 'white' }}>1866</Text>
</Badge>
</Content>
</Container>
);
}
}- NativeBase spectrum of colors are compatible with Badge.
- Replacing Component: React Native
<View>
Configuration
| Property | Default | Option | Description |
|---|---|---|---|
| primary | - | true,false | Add a blue background color to your component |
| success | - | true,false | Add a green background color to your component |
| info | - | true,false | Add a light blue background color to your component as shown |
| warning | - | true,false | Add a yellow warning background color to your component |
| danger | - | true,false | Add a red background color to your component |

