VueUse (original) (raw)

State

createGlobalState

-keep states in the global scope to be reusable across Vue instances

injectLocal

-extended inject with ability to call provideLocal to provide the value in the same component

provideLocal

-extended provide with ability to call injectLocal to obtain the value in the same component

Elements

useResizeObserver

-reports changes to the dimensions of an Element's content or the border-box

useWindowFocus

-reactively track window focus with window.onfocus and window.onblur events

Browser

useColorMode

-reactive color mode (dark / light / customs) with auto data persistence

useDark

-reactive dark mode with auto data persistence

useImage

-reactive load an image in the browser

Sensors

onStartTyping

-fires when users start typing on non-editable elements

useFocus

-reactive utility to track or set the focus state of a DOM element

useFocusWithin

-reactive utility to track if an element or one of its decendants has focus

useFps

-reactive FPS (frames per second)

useIdle

-tracks whether the user is being inactive

usePageLeave

-reactive state to show whether the mouse leaves the page

Network

Animation

useInterval

-reactive counter increases on every interval

useNow

-reactive current Date instance

useRafFn

-call function on every requestAnimationFrame

useTimeout

-update value after a given time with controls

Component

templateRef

-shorthand for binding ref to template element

unrefElement

-retrieves the underlying DOM element from a Vue ref or component instance

useTemplateRefsList

-shorthand for binding refs to template elements and components inside v-for

Watch

until

-promised one-time watch for changes

watchArray

-watch for an array with additions and removals

watchDeep

-shorthand for watching value with {deep: true}

whenever

-shorthand for watching value to be truthy

Reactivity

createRef

-returns a deepRef or shallowRef depending on the deep param

reactify

-converts plain functions into reactive functions

refAutoReset

-a ref which will be reset to the default value after some time

syncRef

-two-way refs synchronization

syncRefs

-keep target refs in sync with a source ref

toRef

-normalize value/ref/getter to ref or computed

toValue

-get the value of value/ref/getter

Array

Time

useCountdown

-wrapper for useIntervalFn that provides a countdown timer

useDateFormat

-get the formatted date according to the string of tokens passed in

Utilities

createUnrefFn

-make a plain function accepting ref and raw values as arguments

get

-shorthand for accessing ref.value

isDefined

-non-nullish checking type guard for Ref

set

-shorthand for ref.value = x

useAsyncQueue

-executes each asynchronous task sequentially and passes the current task result to the next task

useCached

-cache a ref with a custom comparator

useConfirmDialog

-creates event hooks to support modals and confirmation dialog chains

useMemoize

-cache results of functions depending on arguments and keep it reactive

useStepper

-provides helpers for building a multi-step wizard interface

useToggle

-a boolean switcher with utility functions

@Electron

@Firebase

createHead-create the head manager instance.

useHead-update head meta tags reactively.

@Integrations

@Math

useClamp

-reactively clamp a value between two other values

useProjection

-reactive numeric projection from one domain to another

useSum

-get the sum of an array reactively

@Motion

useElementStyle-sync a reactive object to a target element CSS styling

useElementTransform-sync a reactive object to a target element CSS transform.

useMotion-putting your components in motion.

@Router

@RxJS

@SchemaOrg

@Sound

useSound-play sound effects reactively.