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

# mds-mention - mistakes

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

Common incorrect uses of `<mds-mention>`. Each entry pairs the wrong form with the right one and a one-line reason. System-wide rules (boolean-as-string, shadow piercing, Tailwind color utilities, raw native event listening) live in [`agents/mistakes.md`](../../../../agents/mistakes.md) - they apply here too but are not repeated.

#### Do Not Slot Content Into the Component

`<mds-mention>` has no default slot and no named slots. Any child nodes placed inside the tag are silently ignored. Pass all content through the `label` and `icon` props.

```html
<!-- INCORRECT -->
<mds-mention>
  <mds-icon name="mi/baseline/person"></mds-icon>
  mario.rossi
</mds-mention>

<!-- CORRECT -->
<mds-mention label="mario.rossi" icon="mi/baseline/person"></mds-mention>
```

#### Do Not Use a Raw `<span>` Chip Instead of the Component

Wrapping text in a styled `<span>` misses the remove affordance, icon handling, size ramp, and dark-mode token cascade. Use `<mds-mention>` whenever the UI needs an @-mention token.

```html
<!-- INCORRECT -->
<span class="pill">@mario.rossi</span>

<!-- CORRECT -->
<mds-mention label="mario.rossi"></mds-mention>
```

#### Do Not Override Size with Inline CSS

The `size` prop drives icon dimensions, padding, and typography together as a coordinated unit. Setting `font-size`, `width`, or `height` inline breaks that coordination and can misalign the icon and label.

```html
<!-- INCORRECT -->
<mds-mention label="anna.verdi" style="font-size: 20px; height: 40px;"></mds-mention>

<!-- CORRECT -->
<mds-mention label="anna.verdi" size="lg"></mds-mention>
```

#### Do Not Customize Style by Piercing the Shadow DOM

`<mds-mention>` has no public CSS custom property and no shadow parts: the icon size comes from the `size` prop. Targeting internal elements via `>>>`, `/deep/`, or undocumented `::part()` names couples your code to implementation details and will break on minor releases.

```css
/* INCORRECT */
mds-mention >>> mds-icon {
  width: 32px;
}
```

```html
<!-- CORRECT -->
<mds-mention label="anna.verdi" size="md"></mds-mention>
```

#### Do Not Listen for `click` on the Remove Button Directly

The remove button lives inside the shadow DOM and stops its own `click` from propagating: a `click`
listener on the host never sees the remove action (it fires only for clicks on the rest of the
pill), and reaching into the shadow root ties your code to an internal class name. Listen for `mdsMentionDelete` instead - it is the contract, and it names the mention that was
dismissed.

```html
<!-- INCORRECT -->
<mds-mention id="m1" label="marco.bianchi" deletable></mds-mention>
<script>
  document.querySelector('#m1').addEventListener('click', removeMention);
</script>

<!-- CORRECT -->
<mds-mention id="m1" label="marco.bianchi" deletable></mds-mention>
<script>
  document.querySelector('#m1').addEventListener('mdsMentionDelete', removeMention);
</script>
```
