Badge
import { Badge, badgeVariants } from '@hanzo/ui'
Variants
A filled default, a quieter secondary, a destructive, and an outline.
DefaultSecondaryDestructiveOutlineGhostLink
export function Variants() {
return (
<XStack flexWrap="wrap" gap="$3" items="center">
<Badge>Default</Badge>
<Badge variant="secondary">Secondary</Badge>
<Badge variant="destructive">Destructive</Badge>
<Badge variant="outline">Outline</Badge>
<Badge variant="ghost">Ghost</Badge>
<Badge variant="link">Link</Badge>
</XStack>
)
}As a link
`asChild` puts the badge's styling on the anchor you pass.
export function AsChild() {
return (
<Badge asChild variant="outline">
<a href="https://www.npmjs.com/package/@hanzo/ui">@hanzo/ui on npm</a>
</Badge>
)
}Types
export type BadgeVariant =
| 'default'
| 'secondary'
| 'destructive'
| 'outline'
| 'ghost'
| 'link'
| 'inputAdornment'
| 'tags'
| 'muted'
| 'accent'
| 'inherit'export type BadgeSize = 'xs' | 'sm' | 'md' | 'lg'export type BadgeProps = React.ComponentProps<'span'> & {
variant?: BadgeVariant | null
/** A record count's size (14 / 16 / 18). Unset, the 24px label (`lg`). */
size?: BadgeSize | null
/** Width equals height, for a single digit. */
shape?: 'pill' | 'circle'
asChild?: boolean
}Exports
BadgebadgeVariantstype BadgePropstype BadgeVarianttype BadgeSize