Skip to main content
Version: 2.x

AttributeDefinition class

@microsoft/fast-element > AttributeDefinition

AttributeDefinition class

An implementation of Accessor that supports reactivity, change callbacks, attribute reflection, and type conversion for custom elements.

Signature:

export declare class AttributeDefinition implements Accessor 

Implements: Accessor

Constructors

Constructor

Modifiers

Description

(constructor)(Owner, name, attribute, mode, converter)

Creates an instance of AttributeDefinition.

Properties

Property

Modifiers

Type

Description

attribute

readonly

string

The name of the attribute in HTML.

converter?

readonly

ValueConverter

(Optional) A ValueConverter that integrates with the property getter/setter to convert values to and from a DOM string.

mode

readonly

AttributeMode

The AttributeMode that describes the behavior of this attribute.

name

readonly

string

The name of the property associated with the attribute.

Owner

readonly

Function

The class constructor that owns this attribute.

Methods

Method

Modifiers

Description

getValue(source)

Gets the value of the attribute/property on the source element.

setValue(source, newValue)

Sets the value of the attribute/property on the source element.