Skip to main content

@microsoft/fast-foundation > MatchMediaStyleSheetBehavior

MatchMediaStyleSheetBehavior class

A behavior to add or remove a stylesheet from an element based on a media query. The behavior ensures that styles are applied while the a query matches the environment and that styles are not applied if the query does not match the environment.

Signature:
export declare class MatchMediaStyleSheetBehavior extends MatchMediaBehavior 

Constructors

ConstructorModifiersDescription
(constructor)(query, styles)Constructs a MatchMediaStyleSheetBehavior instance.

Properties

PropertyModifiersTypeDescription
queryMediaQueryListThe media query that the behavior operates on.
stylesElementStylesThe styles object to be managed by the behavior.

Methods

MethodModifiersDescription
with(query)staticDefines a function to construct MatchMediaStyleSheetBehaviors for a provided query.