Skip to main content
Version: 2.x

ElementStyles class

@microsoft/fast-element > ElementStyles

ElementStyles class

Represents styles that can be applied to a custom element.

Signature:

export declare class ElementStyles 

Constructors

Constructor

Modifiers

Description

(constructor)(styles)

Creates an instance of ElementStyles.

Properties

Property

Modifiers

Type

Description

behaviors

readonly

ReadonlyArray<HostBehavior<HTMLElement>> | null

The behaviors associated with this set of styles.

strategy

readonly

StyleStrategy

Gets the StyleStrategy associated with these element styles.

styles

readonly

ReadonlyArray<ComposableStyles>

supportsAdoptedStyleSheets

static

readonly

boolean

Indicates whether the DOM supports the adoptedStyleSheets feature.

Methods

Method

Modifiers

Description

normalize(styles)

static

Normalizes a set of composable style options.

setDefaultStrategy(Strategy)

static

Sets the default strategy type to use when creating style strategies.

withBehaviors(behaviors)

Associates behaviors with this set of styles.

withStrategy(Strategy)

Sets the strategy that handles adding/removing these styles for an element.