Adapt UI provides five themes for Badge
with three styles. Use this component
to show the status of an activity.
import { Badge } from "@adaptui/react-native-tailwind";
export default function App() {
return <Badge>Beta</Badge>;
}
Adapt UI provides five themes for badges: base
, primary
, secondary
,
success
, and danger
.
You can use this themed badge based on your specific scenarios.
import { Badge, useTheme } from "@adaptui/react-native-tailwind"
export default function App() {
const tailwind = useTheme();
return (
<>
<Badge>Completed</Badge>
<Badge themeColor="primary">Processing</Badge>
<Badge themeColor="secondary">Waiting</Badge>
<Badge themeColor="success">Success</Badge>
<Badge themeColor="danger">Cancelled</Badge>
</>
)
}
Adapt UI provides three different styles for badges, namely solid
, subtle
,
and outline
. You can use these various styled badge components to give a
better visual hierarchy.
import { Badge, useTheme } from "@adaptui/react-native-tailwind"
export default function App() {
const tailwind = useTheme();
return (
<>
<Badge>Solid</Badge>
<Badge variant="subtle">Subtle</Badge>
<Badge variant="outline">Outline</Badge>
</>
)
}
Adapt UI provides three different sizes for badges, namely sm
, md
, and lg
.
import { Badge, useTheme } from "@adaptui/react-native-tailwind";
export default function App() {
const tailwind = useTheme();
return (
<>
<Badge size="sm">Small</Badge>
<Badge>Medium</Badge>
<Badge size="lg">Large</Badge>
</>
);
}
The prefix is a slot at the beginning or prefix position of a component. Here in the badge, the prefix slot can be used to bring an icon, spinner, or, if we need to think wild, maybe even an avatar. Prefix itself doesn’t have any unique property. It’s a frame that hugs the component inside it.
import { Badge, useTheme, Icon, Check } from "@adaptui/react-native-tailwind";
export default function App() {
const tailwind = useTheme();
return (
<>
<Badge prefix={<Icon icon={<Check />} />} themeColor="success">
Completed
</Badge>
</>
);
}
Badge implements Box accepting all
ViewProps
Name | Description | Type | Default |
---|---|---|---|
size | How large should badge be? Defaults to 'md' | sm md lg |
md |
variant | How the badge should look? | outline subtle solid |
solid |
themeColor | How the badge should be themed? | base primary secondary success danger |
base |
prefix | If added, the tag will show an icon before the tag's text. | JSX.Element | |
textProps | Props for the underlying Text Component | TextProps from React Native |
{} |