<!--
  GENERATED FILE - do not edit by hand.
  Source of truth: src/components/mds-push-notification/ in the magma monorepo (usage/*.md and the
  component's JSDoc). Regenerated on every stencil build (scripts/component-docs.ts).
-->

# mds-push-notification

> `@maggioli-design-system/magma` 2.15.0. Shadow DOM: style it only through the public CSS custom properties and the parts below.

The `<mds-push-notification>` web component is the Magma Design System container that hosts and orchestrates a stack of transient notification items, managing their show/hide lifecycle, entry/exit animations, and overall visibility. It is a compound parent: its default slot holds `mds-push-notification-item` children, and it has no direct HTML primitive equivalent.

#### Semantic Behavior

- **Slot-driven lifecycle**: Items placed in the default slot are animated in automatically; each item animates out and is removed when closed (an item shows its close button only with `dismissible`).
- **Built-in clear button**: The container always renders its own clear button, labelled in the page language ("Clear notifications", "Cancella notifiche"), which animates out every item and hides the container.
- **Auto vs. manual behavior**: With `behavior="auto"` the container shows itself as soon as one or more items are added; with `behavior="manual"` visibility is driven only by the `visible` prop or the imperative methods.
- **Empty-stack auto-hide**: When the last remaining item animates out, the container hides itself regardless of behavior; the clear button and `hide()` hide it too.
- **Emitted events**: `mdsPushNotificationShow` fires when it becomes visible, `mdsPushNotificationHide` when hidden, and `mdsPushNotificationChange` on every transition carrying a `{ visible: boolean }` detail.
- **Imperative API**: Exposes `show()` and `hide()` methods to control visibility programmatically, plus `removeNotification()` to dismiss one or an array of `mds-push-notification-item` elements with the standard outro animation.
- **Animation timing**: The intro and outro motion of the items is set by the component; the fade-out delay and the gap between items are read from the public CSS custom properties `--mds-push-notification-fadeout-delay` and `--mds-push-notification-gap`, so they are themeable without code changes.

#### Properties & Visual Configurations

The container intentionally exposes a minimal prop surface; most configuration is structural (which items you slot in) or stylistic (via CSS custom properties).

#### Other behavioral props

- **`behavior`** selects the visibility strategy: pick `'auto'` (default) when the stack should appear and disappear purely as a function of how many items it contains, and `'manual'` when you want explicit control over when the container is shown via `visible` or the `show()`/`hide()` methods.
- **`visible`** is the controlled visibility flag; set it to drive the container open or closed, while reading it returns the current visibility.

## Read next

- [`examples.md`](examples.md) - correct usage, from the most common case
- [`mistakes.md`](mistakes.md) - the wrong forms, each with the right one
- [Storybook](https://magma-design-system.github.io/magma/storybook/?path=/docs/ui-push-notification--docs) - the live examples, in the published Storybook of `main`
- [`conventions.md`](../../../../agents/conventions.md), [`variants.md`](../../../../agents/variants.md), [`mistakes.md`](../../../../agents/mistakes.md) - the rules shared by every component

## Props

| Prop | Attribute | Type | Default | Description |
| --- | --- | --- | --- | --- |
| `behavior` | `behavior` | `"auto" \| "manual" \| undefined` | `'auto'` | Specifies when the stack shows: with `auto` whenever notifications are added, with `manual` only through `visible` or `show()`. In both, removing the last notification hides it; a click outside does not. |
| `visible` | `visible` | `boolean \| undefined` | - | Specifies if the component is visible or not. |

## Events

| Event | Detail | Description |
| --- | --- | --- |
| `mdsPushNotificationChange` | `MdsPushNotificationEventDetail` | Emits when the component visibility changes |
| `mdsPushNotificationHide` | `void` | Emits when the component is hidden |
| `mdsPushNotificationShow` | `void` | Emits when the component is shown |

## Methods

| Method | Signature | Description |
| --- | --- | --- |
| `hide` | `hide() => Promise<void>` | Hides the notification container. |
| `removeNotification` | `removeNotification(notification: HTMLMdsPushNotificationItemElement \| HTMLMdsPushNotificationItemElement[]) => Promise<void>` | Removes the given notification item(s) from the stack. |
| `show` | `show() => Promise<void>` | Shows the notification container. |

## Slots

| Slot | Description |
| --- | --- |
| (default) | Add `HTML elements` or `components`, it is **recommended** to use `mds-push-notification` element. |

## Parts

| Part | Description |
| --- | --- |
| `notifications` | The container wrapper of the notifications. |

## CSS custom properties

| Property | Description |
| --- | --- |
| `--mds-push-notification-background` | Background of the push notification, supports gradients. |
| `--mds-push-notification-fadeout-delay` | Delay before the push notification starts fading out. |
| `--mds-push-notification-gap` | Gap between multiple push notifications. |

Only these are public. Its other 5 are internal: they may change in any release, do not set them.

## Dependencies

Uses: `mds-button`.
