Badges are used to highlight an item's status for quick recognition.
import { Badge } from 'native-base';
function Example() {
return <Badge>NEW FEATURE</Badge>;
}
function Example() {
return <HStack space={{
base: 2,
md: 4
}} mx={{
base: "auto",
md: 0
}}>
<Badge colorScheme="success">SUCCESS</Badge>
<Badge colorScheme="danger">DANGER</Badge>
<Badge colorScheme="info">INFO</Badge>
<Badge colorScheme="dark">DARK</Badge>
</HStack>;
}
function Example() {
return <HStack space={{
base: 2,
md: 4
}} mx={{
base: "auto",
md: 0
}}>
{["solid", "outline", "subtle"].map(key => <VStack key={key} space={{
base: 1,
md: 4
}}>
<Badge variant={key}>DEFAULT</Badge>
<Badge colorScheme="success" variant={key}>
SUCCESS
</Badge>
<Badge colorScheme="danger" variant={key}>
DANGER
</Badge>
<Badge colorScheme="info" variant={key}>
INFO
</Badge>
</VStack>)}
</HStack>;
}
function Example() {
return <Button endIcon={<Badge colorScheme="secondary" ml={1} rounded="md">
10
</Badge>} mx={{
base: "auto",
md: 0
}}>
Notifications
</Button>;
}
Badge implements
,
,
,
,
,
,
,
,
,
,
,
,
The style variant of the badge.
Type: "outline" | "solid" | "subtle"
The color scheme to use for the badge. Must be a key in theme.colors.
NativeBase ships with a default theme for each component. Check out the default theme of the badge
.
Info:
We can easily extend the badge component theme using extendTheme function as described in the documentation .