# HasTabindex

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

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

Used by 18 types:

- [`UIAwesome\Html\Core\Element\BaseBlock`](/docs/extensions/html-core/reference/element/baseblock/index.md)
- [`UIAwesome\Html\Form\AbstractInputDateTime`](/docs/extensions/html/reference/form/abstractinputdatetime/index.md)
- [`UIAwesome\Html\Form\Button`](/docs/extensions/html/reference/form/button/index.md)
- [`UIAwesome\Html\Form\InputCheckbox`](/docs/extensions/html/reference/form/inputcheckbox/index.md)
- [`UIAwesome\Html\Form\InputColor`](/docs/extensions/html/reference/form/inputcolor/index.md)
- [`UIAwesome\Html\Form\InputEmail`](/docs/extensions/html/reference/form/inputemail/index.md)
- [`UIAwesome\Html\Form\InputFile`](/docs/extensions/html/reference/form/inputfile/index.md)
- [`UIAwesome\Html\Form\InputImage`](/docs/extensions/html/reference/form/inputimage/index.md)
- [`UIAwesome\Html\Form\InputNumber`](/docs/extensions/html/reference/form/inputnumber/index.md)
- [`UIAwesome\Html\Form\InputPassword`](/docs/extensions/html/reference/form/inputpassword/index.md)
- [`UIAwesome\Html\Form\InputRadio`](/docs/extensions/html/reference/form/inputradio/index.md)
- [`UIAwesome\Html\Form\InputRange`](/docs/extensions/html/reference/form/inputrange/index.md)
- [`UIAwesome\Html\Form\InputReset`](/docs/extensions/html/reference/form/inputreset/index.md)
- [`UIAwesome\Html\Form\InputSearch`](/docs/extensions/html/reference/form/inputsearch/index.md)
- [`UIAwesome\Html\Form\InputSubmit`](/docs/extensions/html/reference/form/inputsubmit/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 `tabindex` attribute.

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

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`tabIndex()`](#method-tabIndex) | Sets the `tabindex` attribute. | `HasTabindex` |

## Method details

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

```php
public function tabIndex(int|string|null $value): static
```

Sets the `tabindex` attribute.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$value` | `int\|string\|null` | Tab order value as an integer or string of '-1' or greater, or `null` to remove the attribute. |

**Returns**

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

**Throws**

- [`InvalidArgumentException`](https://www.php.net/manual/en/class.invalidargumentexception.php): if the value is not a valid integer or string representation of '-1' or greater.