# CanBeHidden

> Provides an immutable API for the hidden attribute.

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

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

Used by 4 types:

- [`UIAwesome\Html\Core\Element\BaseBlock`](/docs/extensions/html-core/reference/element/baseblock/index.md)
- [`UIAwesome\Html\Core\Element\BaseInline`](/docs/extensions/html-core/reference/element/baseinline/index.md)
- [`UIAwesome\Html\Core\Element\BaseInput`](/docs/extensions/html-core/reference/element/baseinput/index.md)
- [`UIAwesome\Html\Core\Element\BaseVoid`](/docs/extensions/html-core/reference/element/basevoid/index.md)

Provides an immutable API for the `hidden` attribute.

See also: <https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/hidden>.

## Methods

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

## Method details

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

```php
public function hidden(bool|null $value): static
```

Sets the `hidden` attribute.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$value` | `bool\|null` | Whether to hide the element. Use `true` to hide, `false` to show, or `null` to remove the attribute. |

**Returns**

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