InputColor
API reference › HTML › Form › InputColor
Renders the HTML <input type="color"> element.
Supports the experimental alpha and colorspace attributes. Availability and behavior may vary across
browsers.
The value must be a valid CSS <color> value; defaults to ‘#000000’ if omitted or invalid.
See also: https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input/color.
Properties
Section titled “Properties”| Property | Type | Description | Defined by |
|---|---|---|---|
$attributes protected | mixed[] | HTML attributes array used by the implementing class. Default: []. | UIAwesome\ |
$prefix protected | string | Prefix content string assigned to the element. Default: ''. | UIAwesome\ |
$prefixAttributes protected | array | HTML attributes array for the prefix element. Default: []. | UIAwesome\ |
$prefixTag protected | false|UnitEnum | Tag name for the prefix element, or false to disable. Default: false. | UIAwesome\ |
$suffix protected | string | Suffix content string assigned to the element. Default: ''. | UIAwesome\ |
$suffixAttributes protected | array | HTML attributes array for the suffix element. Default: []. | UIAwesome\ |
$suffixTag protected | false|UnitEnum | Tag name for the suffix element, or false to disable. Default: false. | UIAwesome\ |
$template protected | string | Template string used for constructing the HTML tag. Default: ''. | UIAwesome\ |
Methods
Section titled “Methods”Method details
Section titled “Method details”alpha()
Section titled “alpha() ”public function alpha(bool $value): staticSets the alpha attribute.
Parameters
| Parameter | Type | Description |
|---|---|---|
$value | bool | Whether to allow the user to manipulate the color’s alpha channel. |
Returns
static: New instance with the updated alpha attribute.
autocomplete()
Section titled “autocomplete() ”public function autocomplete(string|Stringable|UnitEnum|null $value): staticSets the autocomplete attribute.
Parameters
| Parameter | Type | Description |
|---|---|---|
$value | string|Stringable|UnitEnum| | Autocomplete value, or null to remove the attribute. |
Returns
static: New instance with the updated autocomplete attribute.
colorspace()
Section titled “colorspace() ”public function colorspace(string|UnitEnum|null $value): staticSets the colorspace attribute.
Parameters
| Parameter | Type | Description |
|---|---|---|
$value | string|UnitEnum| | Color space (‘limited-srgb’ or ‘display-p3’), or null to remove the attribute. |
Returns
static: New instance with the updated colorspace attribute. Colorspace for predefined enum values.
Throws
InvalidArgumentException: if the provided value is not valid.
list()
Section titled “list() ”public function list(string|Stringable|UnitEnum|null $value): staticSets the list attribute.
Parameters
| Parameter | Type | Description |
|---|---|---|
$value | string|Stringable|UnitEnum| | Datalist ID, or null to remove the attribute. |
Returns
static: New instance with the updated list attribute.
getTag()
Section titled “getTag() ”protected function getTag(): UIAwesome\Html\Interop\VoidsReturns the tag enumeration for the <input> element.
Returns
Voids: Tag enumeration instance for <input>.
loadDefault()
Section titled “loadDefault() ”protected function loadDefault(): array<string, mixed>Returns the default configuration for the input element.
Returns
array<string, mixed>: Default configuration for the input element, including the default type attribute set to color.
run()
Section titled “run() ”protected function run(): stringRenders the <input> element with its attributes.
Returns
string: Rendered HTML for the <input> element.