Skip to content
PHP Ecosystem
Explore

HasMaxlength

API reference › HTML › Form › Mixin › HasMaxlength

traitUIAwesome\Html\Form\Mixin\HasMaxlength
Uses traitsHasIntLikeAttribute
Sourcesrc/Form/Mixin/HasMaxlength.php
Used by 7 types

Provides an immutable API for the maxlength attribute.

See also: https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/maxlength.

MethodDescriptionDefined by
maxlength()Sets the maxlength attribute.HasMaxlength
public function maxlength(int|string|Stringable|UnitEnum|null $value): static

Sets the maxlength attribute.

Parameters

ParameterTypeDescription
$valueint|string|Stringable|UnitEnum|nullMaximum length. Must be ’>= 0’, or null to remove the attribute.

Returns

static: New instance with the updated maxlength attribute.

Throws