Skip to content

Badge

import { Badge } from 'yarcl';
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.

reacttypescriptvitecss
<Badge radius="rounded" color="neutral" onRemove={() => remove(tag)} removeLabel={`Remove ${tag}`}>
{tag}
</Badge>
PropTypeDefaultDescription
colorColorconfigconfig.defaults.colorSemantic color, from the colors config.
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.
removeLabelstring'Remove'Accessible label of the remove button.
sizeSizeconfigconfig.defaults.sizeScales with the size's font size, from the sizes config.
variantVariantconfigconfig.defaults.softVariantStyle recipe, from the variants config.