# Badge

Applications can show badges on their icons to notify users of new content. This content may include unread emails, notifications, or new blog posts.

In the following example, the badge is set when the page is loaded. Feel free to dynamically enable this feature.

```twig
<body
    data-controller="pwa--badge"
    data-action="load@window->pwa--badge#update"
    data-pwa--badge-counter-param="42"
>
    ...
</body>
```

### Parameters

None

### Actions

`update`: this action sets a new value `counter` that is passed as argument

`clear`: removes the badge

### Targets

None

### Events

On status change, the event `pwa--badge:updated` is dispatched. The payload property contains the following data:

* `counter`: the value set to the badge.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://pwa.spomky-labs.com/1.3.x/symfony-ux/badge.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
