Skip to main content
Version: 2.x

HostController interface

@microsoft/fast-element > HostController

HostController interface

Controls the lifecycle and context of behaviors and styles associated with a component host.

Signature:

export interface HostController<TSource = any> extends ExpressionController<TSource> 

Extends: ExpressionController<TSource>

Properties

Property

Modifiers

Type

Description

isConnected

readonly

boolean

Indicates whether the host is connected or not.

mainStyles

ElementStyles | null

The main set of styles used for the component, independent of any behavior-specific styles.

Methods

Method

Description

addBehavior(behavior)

Adds the behavior to the component.

addStyles(styles)

Adds styles to this element. Providing an HTMLStyleElement will attach the element instance to the shadowRoot.

removeBehavior(behavior, force)

Removes the behavior from the component.

removeStyles(styles)

Removes styles from this element. Providing an HTMLStyleElement will detach the element instance from the shadowRoot.