On this page
useCssVar
Category | Browser |
---|---|
Export Size | 806 B |
Last Changed | last week |
Manipulate CSS variables
Usage
import { useCssVar } from '@vueuse/core'
const el = ref(null)
const color = useCssVar('--color', el)
const elv = ref(null)
const key = ref('--color')
const colorVal = useCssVar(key, elv)
const someEl = ref(null)
const color = useCssVar('--color', someEl, { initialValue: '#eee' })
Type Declarations
export interface UseCssVarOptions extends ConfigurableWindow {
initialValue?: string
/**
* Use MutationObserver to monitor variable changes
* @default false
*/
observe?: boolean
}
/**
* Manipulate CSS variables.
*
* @see https://vueuse.org/useCssVar
* @param prop
* @param target
* @param options
*/
export declare function useCssVar(
prop: MaybeRefOrGetter<string>,
target?: MaybeElementRef,
options?: UseCssVarOptions
): Ref<string>
Source
© 2019-present Anthony Fu
Licensed under the MIT License.
https://vueuse.org/core/useCssVar/