A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://pikax.me/vue-composable/composable/web/cssVariables below:

Website Navigation


CSS variables | vue-composable

# CSS variables

Expose the CSS variables of your choice to reactive properties. Using MutationObserver (opens new window)

# Parameters Parameters Type Required Default Description variables Record<string, CssVarDef> true dictionary with the cssVariable name you wish to track/change options MutationObserverInit false defaultOptions Options passed to MutationObserver.observe MutationObserverInit (opens new window) element HTMLElement false document.documentElement element to keep track of CssVariables, it will default to document.documentElement if is in a client browser # State

The useCssVariables function exposes the following reactive states:

State Type Description supported Boolean Returns true if MutationObserver is supported observing Ref<Boolean> A value that indicates if the observer is listening to CSS variable changes ...variables Ref<TVariables> Object with the same keys but with reactive CSS variable value # Methods

The useCssVariables function exposes the following methods:

Signature Description resume Start observing the changes again stop Stops observing the changes

TIP

Calling stop() will stop observing for changes in the DOM, changes made to the ref will still update/override the style values.

Check the example bellow.

# Example

Override the value for --color-foreground:

I am a text with the following color: red

# Code

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4