Skip to content

Badge

import { Badge } from '@yarcl/react';
Certified Wonderful Enrichment Educator GraduateCertified Wonderful Enrichment Educator Graduate
primaryneutralsuccesswarningdangerinfosolid
primaryneutralsuccesswarningdangerinfosoft
primaryneutralsuccesswarningdangerinfooutline
primaryneutralsuccesswarningdangerinfoghost
<Badge color="success">Active</Badge>
<Badge color="danger" variant="solid">Overdue</Badge>

Badges use the same variant recipes as buttons. The default is defaults.softVariant.

Use startIcon or endIcon for a decorative status icon. The icon size and the gap from the label follow the badge’s size token.

<Badge color="success" startIcon={<CheckIcon />}>Completed</Badge>
reacttypescriptvitecss
<Badge radius="rounded" color="neutral" onRemove={() => remove(tag)} removeLabel={`Remove ${tag}`}>
{tag}
</Badge>

Labels truncate with an ellipsis to stay within their container. The full label remains in the accessible text, and icons and remove buttons keep their space. Use wrap for a multiline label, including long words.

<Badge>Certified Wonderful Enrichment Educator Graduate</Badge>
<Badge wrap>Certified Wonderful Enrichment Educator Graduate</Badge>
PropTypeDefaultDescription
colorColorconfigconfig.defaults.colorSemantic color, from the colors config.
endIconReactNodeDecorative icon after the label, sized from the badge size.
onRemove() => voidShows a remove button, making the badge a removable tag. Called when it is pressed.
radius'size' | Radiusconfigconfig.defaults.radiusCorner radius, from the radii config.
removeLabelstringconfig.labels.removeAccessible label of the remove button.
size'lg' | 'xs' | 'sm' | 'md' | 'xl'config.defaults.sizeScales with the size's font size, from the sizes config.
startIconReactNodeDecorative icon before the label, sized from the badge size.
variantVariantconfigconfig.defaults.softVariantStyle recipe, from this component's variant map or shared variants.
wrapbooleanAllows the label to wrap onto multiple lines instead of truncating with an ellipsis.