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

# mds-usage

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

The `<mds-usage>` web component is a documentation-oriented annotation block of the Magma Design System used to frame example content as a recommendation, a warning, or an informational note. It wraps slotted content in a labelled, status-colored container and has no native HTML primitive equivalent - it is a presentational guidance device, typically used inside design-system docs and Storybook.

#### Semantic Behavior

- **Status semantics via `variant`**: The chosen `variant` drives the border and header color from the shared status palette (success / info / error / warning) and the header icon (a tick for `do`, an X for `dont`, an info sign for `info`, a warning triangle for `warn`), so the container reads as the matching guidance category even without its color.
- **Label first**: The header label (the `alias`, or the name of the `variant` in the page language) is what tells assistive technology the kind of guidance; the content region has no role of its own.
- **Localized header label**: When `alias` is not provided, the header text is resolved from the bundled locale dictionary (el / en / es / it) keyed by `variant`, so the label follows the document language.
- **Default slot is content**: The default (unnamed) slot accepts a text string, HTML elements, or other components - it is the body of the usage block, not the label.

#### Properties & Visual Configurations

`variant` is the primary configuration prop. Unlike most Magma components, this is NOT the shared variant/tone ladder defined in [`agents/variants.md`](../../../../agents/variants.md); it is a component-specific guidance category:

- **`variant="do"`**: marks recommended / allowed usage (success styling).
- **`variant="dont"`**: marks discouraged / disallowed usage (error styling).
- **`variant="info"`**: neutral informational note (info styling); this is the default.
- **`variant="warn"`**: cautionary note (warning styling).

The `variant` is reflected on the host, where the styles read it, so it colors the block when it is set as a property too (as the React and Angular wrappers set it); without one the host gets `info`.

#### Other behavioral props

- **`alias`** overrides the auto-generated, localized header phrase with a custom string when the default category label is not specific enough for the example being shown.
- **`icon`** replaces the header icon of the `variant` with any icon slug; colors and label still follow the `variant`. When not set or empty, the icon follows the `variant`. The header icon is decorative: the label carries the meaning.

## 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-usage--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 |
| --- | --- | --- | --- | --- |
| `alias` | `alias` | `string \| undefined` | - | Specifies the alias of the usage phrase on the top of the component |
| `icon` | `icon` | `string \| undefined` | - | Specifies the icon displayed in the header; when not set or empty, the icon follows the `variant` |
| `variant` | `variant` | `"do" \| "dont" \| "info" \| "warn"` | `'info'` | Specifies the guidance category of the content, which drives colors, header label and icon |

## Slots

| Slot | Description |
| --- | --- |
| (default) | Add `text string`, `HTML elements` or `components` to this slot. |

## Parts

| Part | Description |
| --- | --- |
| `header` | The header that holds the `icon` and the `label` |
| `icon` | The icon of the header, the one of `variant` unless `icon` is set |
| `label` | The label of the header, the name of `variant` unless `alias` is set |

## CSS custom properties

None is public: its 3 custom properties are internal and may change in any release. Style it with its props, its parts and the semantic roles.

## Dependencies

Uses: `mds-icon`, `mds-text`.
