Collection of Essential Vue Composition Utilities.

On this page



useAnimatereactive [Web Animations API](
useIntervalreactive counter increases on every interval
useIntervalFnwrapper for `setInterval` with controls
useNowreactive current Date instance
useRafFncall function on every `requestAnimationFrame`
useTimeoutupdate value after a given time with controls
useTimeoutFnwrapper for `setTimeout` with controls
useTimestampreactive current timestamp
useTransitiontransition between values


useArrayDifferencereactive get array difference of two arrays
useArrayEveryreactive `Array.every`
useArrayFilterreactive `Array.filter`
useArrayFindreactive `Array.find`
useArrayFindIndexreactive `Array.findIndex`
useArrayFindLastreactive `Array.findLast`
useArrayIncludesreactive `Array.includes`
useArrayJoinreactive `Array.join`
useArrayMapreactive ``
useArrayReducereactive `Array.reduce`
useArraySomereactive `Array.some`
useArrayUniquereactive unique array
useSortedreactive sort array


useBluetoothreactive [Web Bluetooth API](
useBreakpointsreactive viewport breakpoints
useBroadcastChannelreactive [BroadcastChannel API](
useBrowserLocationreactive browser location
useClipboardreactive [Clipboard API](
useClipboardItemsreactive [Clipboard API](
useColorModereactive color mode (dark / light / customs) with auto data persistence
useCssVarmanipulate CSS variables
useDarkreactive dark mode with auto data persistence
useEventListeneruse EventListener with ease
useEyeDropperreactive [EyeDropper API](
useFaviconreactive favicon
useFileDialogopen file dialog with ease
useFileSystemAccesscreate and read and write local files with [FileSystemAccessAPI](
useFullscreenreactive [Fullscreen API](
useGamepadprovides reactive bindings for the [Gamepad API](
useImagereactive load an image in the browser
useMediaControlsreactive media controls for both `audio` and `video` elements
useMediaQueryreactive [Media Query](
useMemoryreactive Memory Info
useObjectUrlreactive URL representing an object
usePerformanceObserverobserve performance metrics
usePermissionreactive [Permissions API](
usePreferredColorSchemereactive [prefers-color-scheme]( media query
usePreferredContrastreactive [prefers-contrast]( media query
usePreferredDarkreactive dark theme preference
usePreferredLanguagesreactive [Navigator Languages](
usePreferredReducedMotionreactive [prefers-reduced-motion]( media query
useScreenOrientationreactive [Screen Orientation API](
useScreenSafeAreareactive `env(safe-area-inset-*)`
useScriptTagcreates a script tag
useSharereactive [Web Share API](
useStyleTaginject reactive `style` element in head
useTextareaAutosizeautomatically update the height of a textarea depending on the content
useTextDirectionreactive [dir]( of the element's text
useTitlereactive document title
useUrlSearchParamsreactive [URLSearchParams](
useVibratereactive [Vibration API](
useWakeLockreactive [Screen Wake Lock API](
useWebNotificationreactive [Notification](
useWebWorkersimple [Web Workers]( registration and communication
useWebWorkerFnrun expensive functions without blocking the UI


computedInjectcombine computed and inject
createReusableTemplatedefine and reuse template inside the component scope
createTemplatePromisetemplate as Promise
templateRefshorthand for binding ref to template element
tryOnBeforeMountsafe `onBeforeMount`
tryOnBeforeUnmountsafe `onBeforeUnmount`
tryOnMountedsafe `onMounted`
tryOnScopeDisposesafe `onScopeDispose`
tryOnUnmountedsafe `onUnmounted`
unrefElementretrieves the underlying DOM element from a Vue ref or component instance
useCurrentElementget the DOM element of current component as a ref
useMountedmounted state in ref
useTemplateRefsListshorthand for binding refs to template elements and components inside `v-for`
useVirtualListcreate virtual lists with ease
useVModelshorthand for v-model binding
useVModelsshorthand for props v-model binding


useActiveElementreactive `document.activeElement`
useDocumentVisibilityreactively track [`document.visibilityState`](
useDraggablemake elements draggable
useDropZonecreate a zone where files can be dropped
useElementBoundingreactive [bounding box]( of an HTML element
useElementSizereactive size of an HTML element
useElementVisibilitytracks the visibility of an element within the viewport
useIntersectionObserverdetects that a target element's visibility
useMouseInElementreactive mouse position related to an element
useMutationObserverwatch for changes being made to the DOM tree
useParentElementget parent element of the given element
useResizeObserverreports changes to the dimensions of an Element's content or the border-box
useWindowFocusreactively track window focus with `window.onfocus` and `window.onblur` events
useWindowScrollreactive window scroll
useWindowSizereactive window size


useEventSourcean [EventSource]( or [Server-Sent-Events]( instance opens a persistent connection to an HTTP server
useFetchreactive [Fetch API]( provides the ability to abort requests
useWebSocketreactive [WebSocket]( client


computedAsynccomputed for async functions
computedEagereager computed without lazy evaluation
computedWithControlexplicitly define the dependencies of computed
extendRefadd extra attributes to Ref
reactifyconverts plain functions into reactive functions
reactifyObjectapply `reactify` to an object
reactiveComputedcomputed reactive object
reactiveOmitreactively omit fields from a reactive object
reactivePickreactively pick fields from a reactive object
refAutoReseta ref which will be reset to the default value after some time
refDebounceddebounce execution of a ref value
refDefaultapply default value to a ref
refThrottledthrottle changing of a ref value
refWithControlfine-grained controls over ref and its reactivity
syncReftwo-way refs synchronization
syncRefskeep target refs in sync with a source ref
toReactiveconverts ref to reactive
toRefnormalize value/ref/getter to `ref` or `computed`
toRefsextended [`toRefs`]( that also accepts refs of an object
toValueget the value of value/ref/getter


onClickOutsidelisten for clicks outside of an element
onKeyStrokelisten for keyboard keystrokes
onLongPresslisten for a long press on an element
onStartTypingfires when users start typing on non-editable elements
useBatteryreactive [Battery Status API](
useDeviceMotionreactive [DeviceMotionEvent](
useDeviceOrientationreactive [DeviceOrientationEvent](
useDevicePixelRatioreactively track [`window.devicePixelRatio`](
useDevicesListreactive [enumerateDevices]( listing available input/output devices
useDisplayMediareactive [`mediaDevices.getDisplayMedia`]( streaming
useElementByPointreactive element by point
useElementHoverreactive element's hover state
useFocusreactive utility to track or set the focus state of a DOM element
useFocusWithinreactive utility to track if an element or one of its decendants has focus
useFpsreactive FPS (frames per second)
useGeolocationreactive [Geolocation API](
useIdletracks whether the user is being inactive
useInfiniteScrollinfinite scrolling of the element
useKeyModifierreactive [Modifier State](
useMagicKeysreactive keys pressed state
useMousereactive mouse position
useMousePressedreactive mouse pressing state
useNavigatorLanguagereactive [navigator.language](
useNetworkreactive [Network status](
useOnlinereactive online state
usePageLeavereactive state to show whether the mouse leaves the page
useParallaxcreate parallax effect easily
usePointerreactive [pointer state](
usePointerLockreactive [pointer lock](
usePointerSwipereactive swipe detection based on [PointerEvents](
useScrollreactive scroll position and state
useScrollLocklock scrolling of the element
useSpeechRecognitionreactive [SpeechRecognition](
useSpeechSynthesisreactive [SpeechSynthesis](
useSwipereactive swipe detection based on [`TouchEvents`](
useTextSelectionreactively track user text selection based on [`Window.getSelection`](
useUserMediareactive [`mediaDevices.getUserMedia`]( streaming


createGlobalStatekeep states in the global scope to be reusable across Vue instances
createInjectionStatecreate global state that can be injected into components
createSharedComposablemake a composable function usable with multiple Vue instances
injectLocalextended `inject` with ability to call `provideLocal` to provide the value in the same component
provideLocalextended `provide` with ability to call `injectLocal` to obtain the value in the same component
useAsyncStatereactive async state
useDebouncedRefHistoryshorthand for `useRefHistory` with debounced filter
useLastChangedrecords the timestamp of the last change
useLocalStoragereactive [LocalStorage](
useManualRefHistorymanually track the change history of a ref when the using calls `commit()`
useRefHistorytrack the change history of a ref
useSessionStoragereactive [SessionStorage](
useStoragecreate a reactive ref that can be used to access & modify [LocalStorage]( or [SessionStorage](
useStorageAsyncreactive Storage in with async support
useThrottledRefHistoryshorthand for `useRefHistory` with throttled filter


useDateFormatget the formatted date according to the string of tokens passed in
useTimeAgoreactive time ago


createEventHookutility for creating event hooks
createUnrefFnmake a plain function accepting ref and raw values as arguments
getshorthand for accessing `ref.value`
isDefinednon-nullish checking type guard for Ref
makeDestructurablemake isomorphic destructurable for object and array at the same time
setshorthand for `ref.value = x`
useAsyncQueueexecutes each asynchronous task sequentially and passes the current task result to the next task
useBase64reactive base64 transforming
useCachedcache a ref with a custom comparator
useClonedreactive clone of a ref
useConfirmDialogcreates event hooks to support modals and confirmation dialog chains
useCounterbasic counter with utility functions
useCycleListcycle through a list of items
useDebounceFndebounce execution of a function
useEventBusa basic event bus
useMemoizecache results of functions depending on arguments and keep it reactive
useOffsetPaginationreactive offset pagination
usePreviousholds the previous value of a ref
useStepperprovides helpers for building a multi-step wizard interface
useSupportedsSR compatibility `isSupported`
useThrottleFnthrottle execution of a function
useTimeoutPolluse timeout to poll something
useTogglea boolean switcher with utility functions
useToNumberreactively convert a string ref to number
useToStringreactively convert a ref to string


untilpromised one-time watch for changes
watchArraywatch for an array with additions and removals
watchAtMost`watch` with the number of times triggered
watchDebounceddebounced watch
watchDeepshorthand for watching value with `{deep: true}`
watchIgnorableignorable watch
watchImmediateshorthand for watching value with `{immediate: true}`
watchOnce`watch` that only triggers once
watchPausablepausable watch
watchThrottledthrottled watch
watchTriggerablewatch that can be triggered manually
watchWithFilter`watch` with additional EventFilter control
whenevershorthand for watching value to be truthy
On this page