Badge

Display a small count or new-state indicator associated with an element.

Live preview
Interact with the component to see results here.
View code
HTML
<sy-badge
  value="8"
  overflowcount="99"
  variant="red"
  position="topRight"
>
  <sy-button aria-label="Received notifications">Notifications</sy-button>
</sy-badge>

Usage guide

#

Show short counts or status indicators as supporting information, such as notification counts. Use Tag or body text for longer explanations.

Attach to a target

Wrap the target element to display the badge at its corner.

Display independently

Use standalone without attaching to another element.

Indicate only that something changed

Use dot to indicate a new state without a number.

Feature examples

#

Choose a feature from 10 topics. Explore property settings, method calls, event results, and slot layouts through live examples and code.

Usage examples · Overview

Try the selected example. Topics with multiple configurations let you switch between detailed examples.

View code
HTML
Loading the example.

Property · Dot

See how settings change appearance and behavior.

View code
HTML
Loading the example.

Property · Hidden

See how settings change appearance and behavior.

View code
HTML
Loading the example.

Property · Overflow Count

See how settings change appearance and behavior.

View code
HTML
Loading the example.

Property · Position

See how settings change appearance and behavior.

View code
HTML
Loading the example.

Property · Size

See how settings change appearance and behavior.

View code
HTML
Loading the example.

Property · Standalone

See how settings change appearance and behavior.

View code
HTML
Loading the example.

Property · Value

See how settings change appearance and behavior.

View code
HTML
Loading the example.

Property · Variant

See how settings change appearance and behavior.

View code
HTML
Loading the example.

Usage examples · Bottom-left badge

Place a green count badge at the bottom-left of its target.

View code
HTML
<sy-badge
  value="12"
  overflowcount="99"
  variant="green"
  position="bottomLeft"
  id="supplement-1"
>
  <sy-button aria-label="Received notifications">Notifications</sy-button>
</sy-badge>

<script type="module">
  const component1 = document.querySelector("#supplement-1");
  Object.assign(component1, {
    "position": "bottomLeft",
    "variant": "green",
    "value": 12
  });
</script>

API reference

#

Hover over a name or focus it with the keyboard to see the code. On touch screens, tap the name.

<sy-badge>

Properties

Attribute / PropertyTypeDefaultDescription
booleanfalseShow a dot instead of a number.
booleanfalseHide the component.
booleanfalseStandalone badge that does not wrap another element.
numberInfinityMaximum displayed count. Larger counts use a + suffix.
number0Count to display.
'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight''topRight'Corner of the wrapped element where the badge appears.
'small' | 'medium''medium'Component size.
'red' | 'yellow' | 'green' | 'blue' | 'gray''red'Component display style.

Slots

SlotDescription
Component body or child items.