Saltar al contenido principal

Function: useCreateElement()

useCreateElement<T>(tagName, options?): HTMLElementTagNameMap[T]

Defined in: src/infrastructure/dom/dom.service.ts:370

Creates a new HTML element.

Type Parameters

T

T extends keyof HTMLElementTagNameMap

The tag name from HTMLElementTagNameMap.

Parameters

tagName

T

The tag name to create.

options?

ElementCreationOptions

Optional element creation options.

Returns

HTMLElementTagNameMap[T]

The newly created element.

Throws

If called outside a browser environment.

Example

const div = useCreateElement("div");
const input = useCreateElement("input", { is: "custom-input" });