# HasBlocking

> Provides an immutable API for the blocking attribute.

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

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

Used by 3 types:

- [`UIAwesome\Html\Metadata\Link`](/docs/extensions/html/reference/metadata/link/index.md)
- [`UIAwesome\Html\Metadata\Script`](/docs/extensions/html/reference/metadata/script/index.md)
- [`UIAwesome\Html\Metadata\Style`](/docs/extensions/html/reference/metadata/style/index.md)

Provides an immutable API for the `blocking` attribute.

See also: <https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/style#blocking>.

## Methods

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

## Method details

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

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

Sets the `blocking` attribute.

Controls whether rendering waits for the external resource.

**Parameters**

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

**Returns**

`static`: New instance with the updated `blocking` attribute. [`Blocking`](/docs/extensions/html-attribute/reference/values/blocking/index.md) for predefined enum values.

**Throws**

- [`InvalidArgumentException`](https://www.php.net/manual/en/class.invalidargumentexception.php): If the value is not valid.