Skip to main content
Version: 2.x

FASTElementDefinition class

@microsoft/fast-element > FASTElementDefinition

FASTElementDefinition class

Defines metadata for a FASTElement.

Signature:

export declare class FASTElementDefinition<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>> 

Properties

Property

Modifiers

Type

Description

attributeLookup

readonly

Record<string, AttributeDefinition>

A map enabling lookup of property by associated attribute name.

attributes

readonly

ReadonlyArray<AttributeDefinition>

The custom attributes of the custom element.

elementOptions

readonly

ElementDefinitionOptions

Options controlling how the custom element is defined with the platform.

getByType

static

readonly

(key: Function) => FASTElementDefinition<Constructable<HTMLElement>> | undefined

Gets the element definition associated with the specified type.

getForInstance

static

readonly

(object: any) => FASTElementDefinition<Constructable<HTMLElement>> | undefined

Gets the element definition associated with the instance.

isDefined

readonly

boolean

Indicates if this element has been defined in at least one registry.

isRegistered

static

Record<string, Function>

The definition has been registered to the FAST element registry.

name

readonly

string

The name of the custom element.

propertyLookup

readonly

Record<string, AttributeDefinition>

A map enabling lookup of attribute by associated property name.

registerAsync

static

(name: string) => Promise<Function>

(ALPHA) Indicates when a custom elements definition has been registered with the fastElementRegistry.

registry

readonly

CustomElementRegistry

The registry to register this component in by default.

shadowOptions?

ShadowRootOptions

(Optional) Options controlling the creation of the custom element's shadow DOM.

styles?

readonly

ElementStyles

(Optional) The styles to associate with the custom element.

template?

ElementViewTemplate

(Optional) The template to render for the custom element.

templateOptions?

TemplateOptions

(ALPHA) (Optional) The template options.

type

readonly

TType

The type this element definition describes.

Methods

Method

Modifiers

Description

compose(type, nameOrDef)

static

Creates an instance of FASTElementDefinition.

define(registry)

Defines a custom element based on this definition.