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

# mds-url-view

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

The `<mds-url-view>` web component renders an embedded preview of an external web page inside a framed browser-like window, wrapping a native `<iframe>` with a titled header, an identifying icon, and a dismiss control. It is the Magma way to surface remote content (typically inside a `mds-modal`) without hand-building chrome around the raw iframe.

#### Semantic Behavior

- **Iframe preview**: The required `src` is loaded into an internal `<iframe>`; the component is purely a presentational frame and does not proxy or sandbox the embedded document beyond the browser defaults.
- **Domain labelling**: When no explicit `label` is provided, the header title falls back to the page's hostname (with a leading `www.` stripped), derived from `src`.
- **Close action**: The header dismiss button emits the `mdsUrlViewClose` event and, when the component is nested inside a `mds-modal`, automatically closes that ancestor modal.
- **Keyboard activation**: The close control can be triggered by keyboard the same way as a pointer click.
- **Localization**: Header tooltip and ARIA strings are resolved in the active language (el / en / es / it).

#### Properties & Visual Configurations

- **`src`** is the only required prop and drives everything else - the iframe source, the fallback header title, and the ARIA descriptions.
- **`label`** overrides the auto-derived hostname shown in the header when a friendlier title is wanted.
- **`icon`** is an SVG filename slug from the Magma icon library shown at the left of the header; it defaults to a generic "explore" glyph when omitted.
- **`loading`** controls iframe fetch timing: `'lazy'` (the default) defers loading until the frame approaches the viewport, while `'eager'` requests the content immediately.

This component does not expose the shared `variant` / `tone` ladders ([`agents/variants.md`](../../../../agents/variants.md)) on its own host; those props are applied internally to the child `mds-button` close control.

## 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-url-view--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 |
| --- | --- | --- | --- | --- |
| `icon` | `icon` | `string \| undefined` | - | Specifies the icon shown in the header, before the label or the domain; without it the header shows the explore icon |
| `label` | `label` | `string \| undefined` | - | Specifies if the window has a label |
| `loading` | `loading` | `"eager" \| "lazy" \| undefined` | `'lazy'` | Specifies whether a browser should load an iframe immediately or to defer loading of images until some conditions are met. |
| `src` | `src` | `string` | - | **Required**. Specifies the URL to the web page |

## Events

| Event | Detail | Description |
| --- | --- | --- |
| `mdsUrlViewClose` | `void` | Emits when the close button is clicked |

## CSS custom properties

| Property | Description |
| --- | --- |
| `--mds-url-view-background` | Background color of the URL view container. |
| `--mds-url-view-color` | Text color used inside the URL view. |
| `--mds-url-view-radius` | Border-radius applied to the URL view container. |
| `--mds-url-view-shadow` | Box-shadow applied to the entire URL view container. |

Only these are public. Its other one is internal: it may change in any release, do not set it.

## Dependencies

Uses: `mds-icon`, `mds-text`, `mds-button`.
