Skip to content

Elements

A group of elements that share a theme and fonts.

One group holds at most one element of each type at a time: once it is destroyed, create() can make that type again. Two independent groups on one page is the supported way to render two card fields.

export interface Elements
create<T extends ElementType>(type: T, options?: ElementOptionsMap[T]): ElementMap[T];

Creates an element of this type. Throws if the group already has one: use getElement() to reuse it.

ParameterType
typeT
options?ElementOptionsMap[T]
destroy(): void;

Destroys every element in the group.

getElement<T extends ElementType>(type: T): ElementMap[T] | null;

The group’s element of this type, or null if it has none.

ParameterType
typeT
update(options: ElementsOptions): void;

Re-applies group-level appearance to every element in the group.

ParameterType
optionsElementsOptions