Skip to content
PHP Ecosystem
Explore

HasRole

API reference › HTML Attribute › Global › HasRole

traitUIAwesome\Html\Attribute\Global\HasRole
Sourcesrc/Global/HasRole.php
Used by 4 types

Provides an immutable API for the role attribute.

See also: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Roles.

MethodDescriptionDefined by
role()Sets the role attribute.HasRole
public function role(string|Stringable|UnitEnum|null $value): static

Sets the role attribute.

Parameters

ParameterTypeDescription
$valuestring|Stringable|UnitEnum|nullARIA role, or null to remove the attribute.

Returns

static: New instance with the updated role attribute. Role for predefined enum values.

Throws