<!--
  GENERATED FILE - do not edit by hand.
  Source of truth: src/components/mds-mention/usage/ in the magma monorepo.
-->

# mds-mention - examples

> The API of this component: [`AGENTS.md`](AGENTS.md).

Correct and idiomatic ways to use the `<mds-mention>` component, ordered from most common to most specialized. The examples assume a working knowledge of the shared component rules in [`agents/conventions.md`](../../../../agents/conventions.md).

#### Basic Inline Mention

The canonical form. Provide `label` with the user handle or display name. The component renders the default `@` glyph; the mention is read-only until `deletable` is set.

```html
<mds-text>
  Ciao <mds-mention label="mario.rossi"></mds-mention>, sei riuscito a inviare il messaggio?
</mds-text>
```

#### Removable Mention

Set `deletable` to show the remove button, then listen for `mdsMentionDelete` on the element. The
event carries the mention that was dismissed, so one handler can serve a whole list.

```html
<mds-mention id="m1" label="mario.rossi" deletable></mds-mention>
<script>
  document.querySelector('#m1').addEventListener('mdsMentionDelete', ({ detail }) => {
    detail.element.remove();
  });
</script>
```

#### Custom Icon

Override the default `@` glyph with any Magma icon slug via the `icon` prop. Use this when the mention refers to a team, group, or entity that has a dedicated icon.

```html
<mds-mention label="team-design" icon="mi/baseline/group"></mds-mention>
```

#### Sizing

Use the `size` prop to match the mention's visual weight to its context. `sm` is the default for dense inline use; `md` scales up the icon and typography; `lg` uses headline-weight typography for prominent placements.

```html
<!-- Dense list or comment thread -->
<mds-mention label="anna.verdi" size="sm"></mds-mention>

<!-- Standard body text -->
<mds-mention label="anna.verdi" size="md"></mds-mention>

<!-- Heading-adjacent or featured mention -->
<mds-mention label="anna.verdi" size="lg"></mds-mention>
```

#### Mention Inside a Comment or Message

Place `<mds-mention>` inline within `<mds-text>` to embed it naturally in body copy, preserving vertical alignment.

```html
<mds-text>
  Il documento e' stato approvato da
  <mds-mention label="lucia.ferrari" icon="mi/baseline/person"></mds-mention>
  e sara' pubblicato domani.
</mds-text>
```

#### Multiple Mentions in One Sentence

Drop several `<mds-mention>` tokens in the same text flow. Each is a self-contained pill; they line-wrap independently.

```html
<mds-text>
  <mds-mention label="marco.bianchi"></mds-mention> e
  <mds-mention label="giulia.conti"></mds-mention>
  sono stati assegnati alla revisione.
</mds-text>
```

#### Styling Customization

`<mds-mention>` has no public CSS custom property and no shadow parts: the icon size follows the `size` prop (see Sizing above), which keeps the icon, the padding and the typography in step. For a larger icon, pick the next size instead of resizing the icon by hand.

```html
<mds-mention label="lucia.ferrari" icon="mi/baseline/person" size="md"></mds-mention>
```
