Skip to content



Generates a single attribute or a list of attributes

Html::attr(string|array $name, mixed $value = null): string|null


Name Type Default Description
$name * string|array String: A single attribute with that name will be generated.
Key-value array: A list of attributes will be generated. Don't pass a second argument in that case.
$value mixed null If used with a $name string, pass the value of the attribute here.
If used with a $name array, this can be set to false to disable attribute sorting.

Return type


Parent class

Kirby\Cms\Html inherited from Kirby\Toolkit\Html