# HasContent

> Provides an immutable API for the content attribute.

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

| trait | `UIAwesome\Html\Attribute\HasContent` |
| --- | --- |
| Source | [`src/HasContent.php`](https://github.com/ui-awesome/html-attribute/blob/main/src/HasContent.php#L18) |

Used by 1 type:

- [`UIAwesome\Html\Metadata\Meta`](/docs/extensions/html/reference/metadata/meta/index.md)

Provides an immutable API for the `content` attribute.

See also: <https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/content>.

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`content()`](#method-content) | Sets the `content` attribute. | `HasContent` |

## Method details

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

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

Sets the `content` attribute.

Defines the metadata value for the current `name` or `http-equiv` entry.

**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` | Metadata content value, or `null` to remove the attribute. |

**Returns**

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