React Native / Core
Badge
Small status label, e.g. "Compatible" or "Out of stock".
import { Badge } from "@stylhero/native";
Example
import { Badge, Stack } from "@stylhero/native";
function BadgeExample() {
return (
<Stack direction="row" gap={2} wrap>
<Badge tone="success">Compatible</Badge>
<Badge tone="danger">Out of stock</Badge>
<Badge>Draft</Badge>
</Stack>
);
}
Props
| Prop | Type | Default | Description |
|---|---|---|---|
children required |
string |
- | |
icon |
ReactNode |
- | |
style |
StyleProp<ViewStyle> |
- | |
tone |
BadgeTone |
"neutral" |
Also takes React Native's View props (testID, accessibilityHint, onLayout…), passed to that View.
Types
type BadgeTone = "neutral" | "primary" | "info" | "accent" | "success" | "danger";
Accessibility
- Read as plain text. Don't rely on its color alone: the word carries the meaning.
Generated from src/components/Badge.tsx. Something wrong or missing? Open an issue.