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

# mds-calendar-cell

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

The `<mds-calendar-cell>` web component represents a single selectable day inside the [`<mds-calendar>`](../mds-calendar/AGENTS.md) grid. It is a presentational child that renders the day number and exposes attributes the parent calendar drives to express the day's role and its position within a selection range.

#### Semantic Behavior

- **Compound child only**: It is rendered only by `<mds-calendar>`, which generates one cell per day of the visible month grid inside its own shadow DOM (the calendar has no default slot): consumers never write it, neither standalone nor as a child of the calendar.
- **Parent-driven selection**: The cell holds no internal selection state. The parent calendar drives the `date`, `selection` and `preview` attributes to paint range boundaries and intermediate days; the cell only reflects what it is given.
- **No own events**: Clicks and hover are handled by the parent (range building, preview, and the `mdsCalendarChange` / `mdsCalendarPreselect` events from `<mds-calendar>`). The cell itself emits nothing.
- **Disabled state**: When `disabled` is set the day cannot be activated; the parent applies this for days outside the calendar's `min`/`max` range.
- **Today marker**: `today` is a presentational flag the parent sets on the cell matching the current date, used only for styling emphasis.

#### Properties & Visual Configurations

Most props are state mirrors written by the parent rather than knobs a consumer tunes directly.

- **`month`**: Distinguishes how the day relates to the displayed month - `current` for in-month days, `other` for leading/trailing days spilling in from adjacent months. The type also allows `weekend`, which is deprecated: the calendar never sets it and it has no styling of its own, since the weekend color comes from the cell's position (the last two columns of the week).
- **`selection`**: Marks the cell's position within an active range - `start`, `end`, `middle`, or `single` (a day alone: a one-day range, the start of a range waiting for its end, the day of a single picker); absence or `none` means unselected. A chosen `start`, `end` or `single` is a full dot, the same mark for both ends; `middle` and the halves of the ends that reach it are the band of the range.
- **`preview`**: When `true`, the selection is a preview of the day under the pointer rather than a chosen one: a paler band, and the `end` (or a `single`) drawn as a ring, not chosen yet. The `start` of a preview is the day already chosen and keeps its full dot.
- **`orientation`**: Selection-connector direction. The type allows `horizontal`, `vertical`, and `both`, but only `horizontal` is currently supported.
- **`date`**: The cell's ISO `YYYY-MM-DD` date; the parent matches against it to compute selection state, so it is required for the cell to participate in range logic.

## 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-calendar-cell--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 |
| --- | --- | --- | --- | --- |
| `date` | `date` | `string \| undefined` | - | Specifies the date of the cell |
| `disabled` | `disabled` | `boolean \| undefined` | `undefined` | Specifies if the cell is disabled |
| `label` | `label` | `string \| undefined` | - | Specifies the label of the cell |
| `month` | `month` | `"current" \| "other" \| "weekend" \| undefined` | `'current'` | Specifies if the day belongs to the displayed month, `current`, or to an adjacent one, `other`. `weekend` is deprecated and does nothing: the weekend days are styled by their column of the week |
| `orientation` | `orientation` | `"both" \| "horizontal" \| "vertical" \| undefined` | `'horizontal'` | Specifies the selection orientation of the cell |
| `preview` | `preview` | `boolean \| undefined` | `false` | Specifies if the selection is a preview or the final selection |
| `selection` | `selection` | `"end" \| "middle" \| "none" \| "single" \| "start" \| undefined` | - | Specifies the point of selection of the cell |
| `today` | `today` | `boolean \| undefined` | `undefined` | Specifies if the cell is today |

## CSS custom properties

| Property | Description |
| --- | --- |
| `--mds-calendar-cell-background` | Background of calendar cells. |
| `--mds-calendar-cell-color` | Text color of calendar cells. |

Only these are public. Its other 36 are internal: they may change in any release, do not set them.

## Dependencies

Uses: `mds-button`.
Used by: `mds-calendar`.
