Skip to main content

@microsoft/fast-element > Controller

Controller class

Controls the lifecycle and rendering of a FASTElement.

export declare class Controller extends PropertyChangeNotifier 


The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the Controller class.


definitionFASTElementDefinitionThe element definition that instructs this controller in how to handle rendering and other platform integrations.
elementHTMLElementThe element being controlled by this controller.
isConnectedbooleanIndicates whether or not the custom element has been connected to the document.
stylesElementStyles | nullGets/sets the primary styles used for the component.
templateElementViewTemplate | nullGets/sets the template used to render the component.
viewElementView | nullThe view associated with the custom element.


addBehaviors(behaviors)Adds behaviors to this element.
addStyles(styles)Adds styles to this element. Providing an HTMLStyleElement will attach the element instance to the shadowRoot.
emit(type, detail, options)Emits a custom HTML event.
forCustomElement(element)staticLocates or creates a controller for the specified element.
onAttributeChangedCallback(name, oldValue, newValue)Runs the attribute changed callback for the associated element.
onConnectedCallback()Runs connected lifecycle behavior on the associated element.
onDisconnectedCallback()Runs disconnected lifecycle behavior on the associated element.
removeBehaviors(behaviors, force)Removes behaviors from this element.
removeStyles(styles)Removes styles from this element. Providing an HTMLStyleElement will detach the element instance from the shadowRoot.