# HasSpellcheck

> Provides an immutable API for the spellcheck 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) › HasSpellcheck

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

Used by 6 types:

- [`UIAwesome\Html\Core\Element\BaseBlock`](/docs/extensions/html-core/reference/element/baseblock/index.md)
- [`UIAwesome\Html\Form\InputEmail`](/docs/extensions/html/reference/form/inputemail/index.md)
- [`UIAwesome\Html\Form\InputSearch`](/docs/extensions/html/reference/form/inputsearch/index.md)
- [`UIAwesome\Html\Form\InputTel`](/docs/extensions/html/reference/form/inputtel/index.md)
- [`UIAwesome\Html\Form\InputText`](/docs/extensions/html/reference/form/inputtext/index.md)
- [`UIAwesome\Html\Form\InputUrl`](/docs/extensions/html/reference/form/inputurl/index.md)

Provides an immutable API for the `spellcheck` attribute.

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

## Methods

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

## Method details

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

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

Sets the `spellcheck` attribute.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$value` | `bool\|string\|null` | Spellcheck state. Use `true` or `false`, or `null` to remove the attribute. |

**Returns**

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

**Throws**

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