Skip to main content
Version: v9

ion-badge

shadow

Badges are inline block elements that usually appear near another element. Typically they contain a number or other characters. They can be used as a notification that there are additional items associated with an element and indicate how many items there are. Badges are hidden if no content is passed in.

Basic Usage

Badges in Tab Buttons

Badges can be added inside a tab button, often used to indicate notifications or highlight additional items associated with the element.

info

Empty badges are only available for md mode.

Theming

Colors

CSS Properties

Properties

color

DescriptionThe color to use from your application's color palette. Default options are: "primary", "secondary", "tertiary", "success", "warning", "danger", "light", "medium", and "dark". For more information on colors, see theming.
Attributecolor
Type"danger" | "dark" | "light" | "medium" | "primary" | "secondary" | "success" | "tertiary" | "warning" | string | undefined
Defaultundefined

hue

DescriptionSet to "bold" for a badge with vibrant, bold colors or to "subtle" for a badge with muted, subtle colors.

Only applies to the ionic theme.
Attributehue
Type"bold" | "subtle" | undefined
Defaultundefined

mode

DescriptionThe mode determines the platform behaviors of the component.

This is a virtual property that is set once during initialization and will not update if you change its value after the initial render.
Attributemode
Type"ios" | "md"
Defaultundefined

shape

DescriptionSet to "rectangular" for non-rounded corners. Set to "soft" for slightly rounded corners. Set to "round" for fully rounded corners.

Defaults to "round" for the ionic theme, undefined for all other themes.
Attributeshape
Type"round | rectangular" | "soft" | undefined
Defaultundefined

size

DescriptionSet to "small" for a small badge. Set to "medium" for a medium badge. Set to "large" for a large badge, when it is empty (no text or icon).

Defaults to "small" for the ionic theme, undefined for all other themes.
Attributesize
Type"large" | "medium" | "small" | undefined
Defaultundefined

theme

DescriptionThe theme determines the visual appearance of the component.

This is a virtual property that is set once during initialization and will not update if you change its value after the initial render.
Attributetheme
Type"ios" | "md" | "ionic"
Defaultundefined

vertical

DescriptionSet to "top" to position the badge on top right absolute position of the parent element. Set to "bottom" to position the badge on bottom right absolute position of the parent element.
Attributevertical
Type"bottom" | "top" | undefined
Defaultundefined

Events

No events available for this component.

Methods

No public methods available for this component.

CSS Shadow Parts

No CSS shadow parts available for this component.

CSS Custom Properties

NameDescription
--backgroundBackground of the badge
--colorText color of the badge
--padding-bottomBottom padding of the badge
--padding-endRight padding if direction is left-to-right, and left padding if direction is right-to-left of the badge
--padding-startLeft padding if direction is left-to-right, and right padding if direction is right-to-left of the badge
--padding-topTop padding of the badge

Slots

No slots available for this component.