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

# mds-calendar-cell - mistakes

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

Common incorrect uses of `<mds-calendar-cell>`. 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 the Cell Outside Its Parent Calendar

`<mds-calendar-cell>` is rendered by [`<mds-calendar>`](../mds-calendar/AGENTS.md) itself, one per day inside its shadow DOM. Used in isolation it loses the gap context that drives range connector geometry and no parent coordinates selection across cells; slotted into `<mds-calendar>`, which has no default slot, it is never shown. Let the calendar generate the cells.

```html
<!-- INCORRECT -->
<mds-calendar-cell date="2024-06-10" label="10" month="current" selection="single"></mds-calendar-cell>

<!-- CORRECT -->
<mds-calendar single-picker start-date="2024-06-10"></mds-calendar>
```

#### Do Not Manage Selection State Locally in the Cell

The cell is purely presentational - it holds no internal state. Setting `selection` directly on isolated cells and keeping them in sync by hand duplicates the logic the parent calendar already owns and will diverge on re-renders.

```html
<!-- INCORRECT: manually wiring selection outside mds-calendar -->
<div class="custom-grid">
  <mds-calendar-cell date="2024-06-03" label="3" selection="start"></mds-calendar-cell>
  <mds-calendar-cell date="2024-06-04" label="4" selection="middle"></mds-calendar-cell>
  <mds-calendar-cell date="2024-06-05" label="5" selection="end"></mds-calendar-cell>
</div>

<!-- CORRECT: let mds-calendar own range state and drive cell props -->
<mds-calendar start-date="2024-06-03" end-date="2024-06-05"></mds-calendar>
```

#### Do Not Pierce the Shadow DOM to Style Internals

The cells live in the shadow DOM of `<mds-calendar>`: from outside they are adjusted only through their public `--mds-calendar-cell-*` custom properties, set on the calendar, which the cells inherit. Targeting the internal `.action`, `.inner-dot`, or `.area-background` elements via `>>>` or undocumented class selectors couples your code to the implementation and will break on minor releases.

```css
/* INCORRECT */
mds-calendar-cell >>> .area-background {
  background: hotpink;
}
mds-calendar-cell >>> .inner-dot {
  display: none;
}

/* CORRECT */
mds-calendar {
  --mds-calendar-cell-other-month-visibility: hidden;
  --mds-calendar-cell-background: rgb(var(--magma-wash-soft));
}
```
