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

# mds-card-media

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

The `<mds-card-media>` web component is the media region of a [`<mds-card>`](../mds-card/AGENTS.md): it wraps an image, video or other visual asset and provides an optional overlay layer for text or controls rendered on top of that asset. It is a layout child with no HTML primitive equivalent - it exists purely to occupy and style the card's `media` region.

#### Semantic Behavior

- **Compound child only**: `<mds-card-media>` is designed to live as a direct child of `<mds-card>` and must not be used standalone or mixed in as a different card region.
- **Self-slotting into the parent**: It lands in the card's `media` region automatically without the author setting any `slot`, and its presence is factored into the card layout.
- **Two-layer composition**: The default slot holds the media asset itself (recommended `mds-img` or another media component), while the named `content` slot overlays that asset, bottom-aligned and centered, so overlay text/actions float in front of the media.
- **No interactive state**: The component holds no props, state, events, ARIA roles or focus behavior of its own - it is a passive presentational wrapper, and any semantics come from the elements slotted into it.

#### Slot semantics and layout role

`<mds-card-media>` exposes no configurable properties; its behavior is entirely defined by its two slots and its position inside the card.

- **default slot**: the media surface. Place the actual visual asset here (an `mds-img`, video, or equivalent component). This layer fills the host.
- **`content` slot**: an overlay layer (exposed as the `content` shadow part) positioned over the media, aligned to the bottom and horizontally centered, intended for captions, titles, or action controls that should appear in front of the media rather than beside it.

The host paints a neutral background, so the media region keeps a defined surface even before its asset loads. Neither this component nor the parent card uses the shared variant/tone system of [`agents/variants.md`](../../../../agents/variants.md).

## 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/layout-card-media--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

## Slots

| Slot | Description |
| --- | --- |
| (default) | Add `HTML elements` or `components` to this slot, it is **recommended** to add `mds-img` element or other component which represents media contents. |
| `content` | Add `text string`, `HTML elements` or `components` to this slot, contents will be shown in front of the media element. |

## Parts

| Part | Description |
| --- | --- |
| `content` | The layer in front of the media that holds the `content` slot |
