# SrcInterface

> Defines the contract for elements that expose the src attribute.

[API reference](/docs/api/index.md) › [HTML Contracts](/docs/extensions/html-contracts/reference/index.md) › [Attribute](/docs/extensions/html-contracts/reference/attribute/index.md) › SrcInterface

| interface | `UIAwesome\Html\Contracts\Attribute\SrcInterface` |
| --- | --- |
| Source | [`src/Attribute/SrcInterface.php`](https://github.com/ui-awesome/html-contracts/blob/main/src/Attribute/SrcInterface.php#L15) |

Implemented by 8 types:

- [`UIAwesome\Html\Embedded\Audio`](/docs/extensions/html/reference/embedded/audio/index.md)
- [`UIAwesome\Html\Embedded\Iframe`](/docs/extensions/html/reference/embedded/iframe/index.md)
- [`UIAwesome\Html\Embedded\Img`](/docs/extensions/html/reference/embedded/img/index.md)
- [`UIAwesome\Html\Embedded\Source`](/docs/extensions/html/reference/embedded/source/index.md)
- [`UIAwesome\Html\Embedded\Track`](/docs/extensions/html/reference/embedded/track/index.md)
- [`UIAwesome\Html\Embedded\Video`](/docs/extensions/html/reference/embedded/video/index.md)
- [`UIAwesome\Html\Form\InputImage`](/docs/extensions/html/reference/form/inputimage/index.md)
- [`UIAwesome\Html\Metadata\Script`](/docs/extensions/html/reference/metadata/script/index.md)

Defines the contract for elements that expose the `src` attribute.

Applies to elements that embed an external resource, such as images, scripts, frames, and media sources.

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`src()`](#method-src) abstract | Sets the `src` attribute. | `SrcInterface` |

## Method details

### src() <span id="method-src"></span>

```php
abstract public function src(string|Stringable|UnitEnum|null $value): static
```

Sets the `src` attribute.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$value` | `string\|`[`Stringable`](https://www.php.net/manual/en/class.stringable.php)`\|`[`UnitEnum`](https://www.php.net/manual/en/class.unitenum.php)`\|null` | URL of the embedded resource, or `null` to remove the attribute. |

**Returns**

`static`: New instance with the updated `src` attribute.