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 ElementsMethods
Section titled “Methods”create()
Section titled “create()”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.
| Parameter | Type |
|---|---|
type | T |
options? | ElementOptionsMap[T] |
destroy()
Section titled “destroy()”destroy(): void;Destroys every element in the group.
getElement()
Section titled “getElement()”getElement<T extends ElementType>(type: T): ElementMap[T] | null;The group’s element of this type, or null if it has none.
| Parameter | Type |
|---|---|
type | T |
update()
Section titled “update()”update(options: ElementsOptions): void;Re-applies group-level appearance to every element in the group.
| Parameter | Type |
|---|---|
options | ElementsOptions |