Skip to content
PHP Ecosystem
Explore

CanBeSelected

API reference › HTML Attribute › CanBeSelected

traitUIAwesome\Html\Attribute\CanBeSelected
Sourcesrc/CanBeSelected.php
Used by 1 type

Provides an immutable API for the selected attribute.

See also: https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/option#selected.

MethodDescriptionDefined by
selected()Sets the selected attribute.CanBeSelected
public function selected(bool|null $value): static

Sets the selected attribute.

Parameters

ParameterTypeDescription
$valuebool|nullSelected state. Use true to mark selected, false to unselect, or null to remove the attribute.

Returns

static: New instance with the updated selected attribute.