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

# mds-video-wall - examples

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

Correct and idiomatic ways to use the `<mds-video-wall>` component, ordered from most common to most specialized. The examples assume a working knowledge of the shared component rules in [`agents/conventions.md`](../../../../agents/conventions.md).

#### Minimal Ambient Background

The simplest and most common use: a full-bleed autoplaying video loop with no extra configuration needed, because `autoplay`, `loop`, and `muted` are all `true` by default.

```html
<mds-video-wall src="/assets/video/ambient.mp4"></mds-video-wall>
```

#### Poster Image for Initial Frame

Supply a `poster` image so users see a meaningful still frame before the video loads, or on devices where autoplay is suppressed by the browser.

```html
<mds-video-wall
  src="/assets/video/ambient.mp4"
  poster="/assets/video/ambient-preview.webp"
></mds-video-wall>
```

#### Noise Overlay for Texture

Add a grain overlay with `noise` to give the video a cinematic or retro feel. Choose the texture that fits the intended mood: `classic`, `sharp`, `soft`, or `tv`.

```html
<!-- Subtle classic grain -->
<mds-video-wall src="/assets/video/ambient.mp4" noise="classic"></mds-video-wall>

<!-- High-contrast TV static -->
<mds-video-wall src="/assets/video/ambient.mp4" noise="tv"></mds-video-wall>
```

#### Foreground Content Overlay via the `content` Slot

Place any text, HTML elements, or Magma components in the `content` slot to render them centered above the video. The overlay wrapper is shown only while this slot is populated, also when the content is added after the first render, so an empty overlay never affects layout.

```html
<mds-video-wall src="/assets/video/ambient.mp4" noise="soft">
  <div slot="content" class="text-on-inverse text-center">
    <mds-text typography="h1">Benvenuto in Magma</mds-text>
    <mds-button label="Scopri di piu" variant="primary" tone="strong"></mds-button>
  </div>
</mds-video-wall>
```

#### Browser Fallback via the Default Slot

The default (unnamed) slot is projected inside the native `<video>` element. Use it for the message displayed when the browser does not support video playback.

```html
<mds-video-wall src="/assets/video/ambient.mp4">
  Il tuo browser non supporta la riproduzione video. Aggiorna il browser per continuare.
</mds-video-wall>
```

#### Disabling Autoplay with Controlled Preload

When the video should not play automatically - for example on a media showcase page - set `autoplay` and `loop` to `false` via a framework binding or a JS property assignment, and use `preload` to control how eagerly the file is fetched. Note: `preload` is ignored by the browser while `autoplay` is active.

```html
<!--
  autoplay and loop default to true: turn them off with a framework
  property binding or the JS properties below.
  Do NOT write autoplay="false" in plain HTML - see mistakes.md.
-->
<mds-video-wall
  src="/assets/video/showcase.mp4"
  poster="/assets/video/showcase-preview.webp"
  preload="metadata"
></mds-video-wall>
```

```javascript
// Disable autoplay and loop via JS property when not using a framework
const wall = document.querySelector('mds-video-wall');
wall.autoplay = false;
wall.loop = false;
```

#### CSS Customization via Documented Properties

Set the video fit through the public `--mds-video-wall-video-fit` CSS custom property, on the host element or a parent selector. The noise overlay has no public CSS custom property: pick its texture with the `noise` prop (`classic`, `sharp`, `soft`, `tv`) or turn it off with `noise="none"`.

```css
/* Contained fit for a non-16:9 source */
.hero-section mds-video-wall {
  --mds-video-wall-video-fit: contain;
}
```
