Skip to content

Badge Component

Display badge component with different styles and types.

Properties

NameTypeDefaultDescription
valuestring | number''The value to display inside the badge.
type'pill' | 'numeral' | 'dot''pill'The type of the badge.
variant'success' | 'error' | 'info' | 'warning' | 'inverse''inverse'The variant style of the badge.
priority'high' | 'low''high'The priority level of the badge.
leadingIconbooleanfalseWhether to show an icon before the badge value.

CSS Parts

NameDescription
badgeThe main badge element.
iconThe icon inside the badge.

Check this link to learn how to use CSS parts for Badge Component.

CSS Properties

TokenDefaultDescription
--tap-font-family--tap-sys-font-familyFont family of the badge.
--tap-badge-line-height--tap-sys-typography-body-xs-heightLine height of the badge text.
--tap-badge-font-size--tap-sys-typography-body-xs-sizeFont size of the badge text.
--tap-badge-font-weight--tap-sys-typography-body-xs-weightFont weight of the badge text.
--tap-badge-color--tap-sys-color-content-primaryText color of the badge.
--tap-badge-border-radius--tap-sys-radius-4Border radius of the badge.
--tap-badge-icon-margin--tap-sys-spacing-2Margin around the icon.
--tap-badge-pill-numeral-border-radius--tap-sys-radius-4Border radius for pill and numeral types.
--tap-badge-pill-numeral-vertical-padding--tap-sys-spacing-2Vertical padding for pill and numeral types.
--tap-badge-pill-numeral-horizontal-padding--tap-sys-spacing-4Horizontal padding for pill and numeral types.
--tap-badge-dot-width6pxWidth of the dot type badge.
--tap-badge-dot-height6pxHeight of the dot type badge.
--tap-badge-dot-margin3pxMargin around the dot type badge.
--tap-badge-info-background-color--tap-sys-color-surface-accentBackground color for info variant.
--tap-badge-info-color--tap-sys-color-content-on-negativeText color for info variant.
--tap-badge-success-background-color--tap-sys-color-surface-positiveBackground color for success variant.
--tap-badge-success-color--tap-sys-color-content-on-negativeText color for success variant.
--tap-badge-error-background-color--tap-sys-color-surface-negativeBackground color for error variant.
--tap-badge-error-color--tap-sys-color-content-on-negativeText color for error variant.
--tap-badge-warning-background-color--tap-sys-color-surface-warningBackground color for warning variant.
--tap-badge-warning-color--tap-sys-color-content-on-warningText color for warning variant.
--tap-badge-inverse-background-color--tap-sys-color-surface-disabledBackground color for inverse variant.
--tap-badge-inverse-color--tap-sys-color-content-tertiaryText color for inverse variant.
--tap-badge-info-low-background-color--tap-sys-color-surface-accent-lightBackground color for low priority info variant.
--tap-badge-info-low-color--tap-sys-color-content-accentText color for low priority info variant.
--tap-badge-success-low-background-color--tap-sys-color-surface-positive-lightBackground color for low priority success variant.
--tap-badge-success-low-color--tap-sys-color-content-positiveText color for low priority success variant.
--tap-badge-error-low-background-color--tap-sys-color-surface-negative-lightBackground color for low priority error variant.
--tap-badge-error-low-color--tap-sys-color-content-negativeText color for low priority error variant.
--tap-badge-warning-low-background-color--tap-sys-color-surface-warning-lightBackground color for low priority warning variant.
--tap-badge-warning-low-color--tap-sys-color-content-warningText color for low priority warning variant.