@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.

name

readonly

string

The name of the custom element.

propertyLookup

readonly

Record<string, AttributeDefinition>

A map enabling lookup of attribute by associated property name.

registry

readonly

CustomElementRegistry

The registry to register this component in by default.

schema?

Schema

(Optional) The optional schema associated with the custom element definition. Declarative templates assign this automatically during template resolution. Non-declarative callers can provide one for schema-driven extensions.

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<InstanceType<TType>>

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

type

readonly

TType

The type this element definition describes.

Methods

Method

Modifiers

Description

compose(type, nameOrDef)

static

Creates an instance of FASTElementDefinition.

define(registry, extensions)

Defines a custom element based on this definition.