Template
API reference › HTML › Metadata › Template
Renders the HTML <template> element for inert HTML fragments.
Supports experimental declarative shadow DOM attributes. Availability and behavior may vary across browsers.
See also: https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/template (BaseBlock for the base implementation.).
Properties
Section titled “Properties”| Property | Type | Description | Defined by |
|---|---|---|---|
$attributes protected | mixed[] | HTML attributes array used by the implementing class. Default: []. | UIAwesome\ |
$content protected | string | Content string assigned to the element. Default: ''. | UIAwesome\ |
Methods
Section titled “Methods”Method details
Section titled “Method details”shadowRootClonable()
Section titled “shadowRootClonable() ”public function shadowRootClonable(bool $value): staticSets the shadowrootclonable attribute.
Parameters
| Parameter | Type | Description |
|---|---|---|
$value | bool | Whether to allow cloning the generated shadow root. |
Returns
static: New instance with the updated shadowrootclonable attribute.
shadowRootDelegatesFocus()
Section titled “shadowRootDelegatesFocus() ”public function shadowRootDelegatesFocus(bool $value): staticSets the shadowrootdelegatesfocus attribute.
Parameters
| Parameter | Type | Description |
|---|---|---|
$value | bool | Whether to delegate focus into the generated shadow root. |
Returns
static: New instance with the updated shadowrootdelegatesfocus attribute.
shadowRootMode()
Section titled “shadowRootMode() ”public function shadowRootMode(string|UnitEnum|null $value): staticSets the shadowrootmode attribute.
Parameters
| Parameter | Type | Description |
|---|---|---|
$value | string|UnitEnum| | Shadow root mode (‘open’ or ‘closed’), or null to remove the attribute. |
Returns
static: New instance with the updated shadowrootmode attribute. ShadowRootMode for predefined enum values.
Throws
InvalidArgumentException: if the provided value is not valid.
shadowRootReferenceTarget()
Section titled “shadowRootReferenceTarget() ”public function shadowRootReferenceTarget(string|Stringable|UnitEnum|null $value): staticSets the shadowrootreferencetarget attribute.
Parameters
| Parameter | Type | Description |
|---|---|---|
$value | string|Stringable|UnitEnum| | Reference target ID, or null to remove the attribute. |
Returns
static: New instance with the updated shadowrootreferencetarget attribute.
shadowRootSerializable()
Section titled “shadowRootSerializable() ”public function shadowRootSerializable(bool $value): staticSets the shadowrootserializable attribute.
Parameters
| Parameter | Type | Description |
|---|---|---|
$value | bool | Whether to allow serializing the generated shadow root. |
Returns
static: New instance with the updated shadowrootserializable attribute.
getTag()
Section titled “getTag() ”protected function getTag(): UIAwesome\Html\Interop\MetadataBlockReturns the tag enumeration for the <template> element.
Returns
MetadataBlock: Tag enumeration instance for <template>. MetadataBlock for valid metadata block-level tags.