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

# mds-list-item - mistakes

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

Common incorrect uses of `<mds-list-item>`. 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 Use `<mds-list-item>` Outside `<mds-list>`

`<mds-list-item>` is a compound child; it must be a direct default-slot child of [`<mds-list>`](../mds-list/AGENTS.md). Using it standalone removes the list context that assistive technology relies on.

```html
<!-- INCORRECT -->
<div>
  <mds-list-item>Primo elemento</mds-list-item>
  <mds-list-item>Secondo elemento</mds-list-item>
</div>

<!-- CORRECT -->
<mds-list>
  <mds-list-item>Primo elemento</mds-list-item>
  <mds-list-item>Secondo elemento</mds-list-item>
</mds-list>
```

#### Do Not Put HTML Elements in the Default Slot

The default slot is meant for plain text only; nested elements are not stripped, they render inline and can break layout. Use the `typography` and `variant` props to control text style instead.

```html
<!-- INCORRECT -->
<mds-list>
  <mds-list-item>
    <strong>Titolo voce</strong>
    <small> - descrizione aggiuntiva</small>
  </mds-list-item>
</mds-list>

<!-- CORRECT -->
<mds-list>
  <mds-list-item typography="detail">Titolo voce - descrizione aggiuntiva</mds-list-item>
</mds-list>
```

#### Do Not Slot `<mds-icon>` to Add a Leading Icon

The `icon` prop renders the glyph through the shared icon service and positions it correctly. Slotting `<mds-icon>` puts it in the text-only default slot, where it is misaligned and the default bullet still renders.

```html
<!-- INCORRECT -->
<mds-list>
  <mds-list-item>
    <mds-icon name="mi/baseline/check"></mds-icon>
    Servizio attivo
  </mds-list-item>
</mds-list>

<!-- CORRECT -->
<mds-list>
  <mds-list-item icon="mi/baseline/check">Servizio attivo</mds-list-item>
</mds-list>
```

#### Do Not Use a `typography` Value Outside the Accepted Set

`<mds-list-item>` accepts only `TypographyInfoType | TypographyReadType`: `caption`, `detail`, `label`, `option`, `paragraph`, `tip`. Heading values like `h1`-`h6` or `action` are outside the type and are not checked at runtime: the inner text renders the heading style next to a bullet aligned for body text.

```html
<!-- INCORRECT -->
<mds-list>
  <mds-list-item typography="h3">Titolo sezione</mds-list-item>
  <mds-list-item typography="action">Azione</mds-list-item>
</mds-list>

<!-- CORRECT -->
<mds-list>
  <mds-list-item typography="detail">Voce elenco</mds-list-item>
  <mds-list-item typography="paragraph">Descrizione estesa della voce</mds-list-item>
</mds-list>
```

#### Do Not Pierce Shadow DOM to Style the Icon or Text

`<mds-list-item>` has no public CSS custom property: the supported customization surface is `::part(icon)` / `::part(text)`, the two documented shadow parts. Targeting internals via `>>>` or undocumented class names couples code to the implementation.

```css
/* INCORRECT */
mds-list-item >>> .icon {
  fill: red;
}

/* CORRECT */
mds-list-item::part(icon) {
  fill: rgb(var(--magma-danger-fg));
}
```

#### Do Not Replace `<mds-list>` + `<mds-list-item>` with a Raw `<ul>` + `<li>`

When a Magma list is needed, use the component pair - not raw HTML. Raw elements bypass the design-system theming, token integration, and high-contrast support.

```html
<!-- INCORRECT -->
<ul>
  <li>Documento ricevuto</li>
  <li>In attesa di approvazione</li>
</ul>

<!-- CORRECT -->
<mds-list>
  <mds-list-item>Documento ricevuto</mds-list-item>
  <mds-list-item>In attesa di approvazione</mds-list-item>
</mds-list>
```
