Dark Light
System
Default LBBW Jira Confluence Source Code
Share
Playground

Badge

<afp-badge> Since 1.0.0 stable This component uses the light DOM, so its markup and styles are part of the regular document flow.

A small visual indicator used to display status, count, or notification information.

Badge

Examples #

Variants #

Use the variant attribute to set the badge's semantic variant.

Neutral Brand Accent Info Error Success Warning

Appearance #

Use the appearance attribute to set the badge's visual appearance.

Default Filled Outlined Outlined filled Plain
Default Filled Outlined Outlined filled Plain
Default Filled Outlined Outlined filled Plain
Default Filled Outlined Outlined filled Plain
Default Filled Outlined Outlined filled Plain
Default Filled Outlined Outlined filled Plain
Default Filled Outlined Outlined filled Plain

Shapes #

Use the shape attribute to change a badge's shape.

Pill Rounded Soft Square

Sizes #

Use the size attribute to change a badge's size.

Small Medium Large

Pulse #

Use the pulse attribute to add a pulsing animation to the badge.

Neutral Brand Accent Info Error Success Warning

Bounce #

Use the bounce attribute to add a bouncing animation to the badge.

Neutral Brand Accent Info Error Success Warning

With Buttons #

A common way to use badges is by placing them on buttons. To simplify this, badges are automatically aligned to the top-right corner when they are nested inside a button.

Requests 23 Warnings 5 Errors 8

Properties

Learn more about properties.

Name Description Reflects
variant
variant of badge
Type
AfpVariant
Name Description
NEUTRAL
The main call-to-action.
BRAND
Less prominent than primary.
ACCENT
Secondary highlight for emphasis.
ERROR
Used for destructive or critical actions.
INFO
Conveys general information.
SUCCESS
Indicates a successful or positive action.
WARNING
Communicates cautionary actions.
AfpVariant
Default AfpVariant.NEUTRAL
size
size of badge
Type
AfpSize
Name Description
SMALL
Small size with compact dimensions.
MEDIUM
Medium size with standard dimensions.
LARGE
Large size with expanded dimensions.
AfpSize
Default AfpSize.MEDIUM
shape
shape of the badge
Type
AfpShape
Name Description
PILL
Makes the component circular.
ROUNDED
Makes the component rounded.
SOFT
Makes the component have soft edges.
SQUARE
Makes the component square.
AfpShape
Default AfpShape.SOFT
appearance
appearance of badge
Type
AfpAppearance
Name Description
DEFAULT
Highlighted, primary action (default).
OUTLINED
Transparent background with a visible border.
PLAIN
Minimal, no border or background.
FILLED
Solid background, no border.
OUTLINED_FILLED
Solid background with a visible border.
AfpAppearance
Default AfpAppearance.DEFAULT
pulse
enables pulse animation
Type boolean
Default false
bounce
enables bounce animation
Type boolean
Default false
label
aria label for the badge. This is used for accessibility purposes to provide a text alternative for screen readers.
Type string

Slots

Learn more about slots.

Name Description
default
The default slot for the badge content (e.g., text or icon).

Internationalization

Learn more about internationalization.

Key Description
badge.aria-label
The default aria-label for the badge component.

CSS Parts

Learn more about CSS Parts.

Name Description Selector
base
The component's base wrapper.
::part(base)

CSS Custom Properties

Name Description Default
--afp-badge-pulse-color
The color used for the pulse animation.
--variant-color-fill
--afp-badge-pulse-speed
The speed of the pulse animation.
1.5s
--afp-badge-bounce-speed
The speed of the bounce animation.
1s

Importing

Using the bundle is the recommended method to include components. If you’d rather handle imports manually, you can use the code examples below.

import '@afp-design-system/core/dist/components/badge/badge.js';
Share
Create a link with a predefined theme that is automatically applied when the generated link is opened. Default LBBW Presentation Mode
Abort Copy Link