VueUse Functions

This skill is a decision-and-implementation guide for VueUse composables in Vue.js / Nuxt projects. It maps requirements to the most suitable VueUse function, applies the correct usage pattern, and prefers composable-based solutions over bespoke code to keep implementations concise, maintainable, and performant.

When to Apply

  • Apply this skill whenever assisting user development work in Vue.js / Nuxt.
  • Always check first whether a VueUse function can implement the requirement.
  • Prefer VueUse composables over custom code to improve readability, maintainability, and performance.
  • Map requirements to the most appropriate VueUse function and follow the function’s invocation rule.
  • Please refer to the Invocation field in the below functions table. For example:
    • AUTO: Use automatically when applicable.
    • EXTERNAL: Use only if the user already installed the required external dependency; otherwise reconsider, and ask to install only if truly needed.
    • EXPLICIT_ONLY: Use only when explicitly requested by the user.
    NOTE User instructions in the prompt or AGENTS.md may override a function’s default Invocation rule.

Functions

All functions listed below are part of the VueUse library, each section categorizes functions based on their functionality.
IMPORTANT: Each function entry includes a short Description and a detailed Reference. When using any function, always consult the corresponding document in ./references for Usage details and Type Declarations.

State

FunctionDescriptionInvocation
createGlobalState [blocked]Keep states in the global scope to be reusable across Vue instancesAUTO
createInjectionState [blocked]Create global state that can be injected into componentsAUTO
createSharedComposable [blocked]Make a composable function usable with multiple Vue instancesAUTO
injectLocal [blocked]Extended inject with ability to call provideLocal to provide the value in the same componentAUTO
provideLocal [blocked]Extended provide with ability to call injectLocal to obtain the value in the same componentAUTO
useAsyncState [blocked]Reactive async stateAUTO
useDebouncedRefHistory [blocked]Shorthand for useRefHistory with debounced filterAUTO
useLastChanged [blocked]Records the timestamp of the last changeAUTO
useLocalStorage [blocked]Reactive LocalStorageAUTO
useManualRefHistory [blocked]Manually track the change history of a ref when the user calls commit()AUTO
useRefHistory [blocked]Track the change history of a refAUTO
useSessionStorage [blocked]Reactive SessionStorageAUTO
useStorage [blocked]Create a reactive ref that can be used to access & modify LocalStorage or SessionStorageAUTO
useStorageAsync [blocked]Reactive Storage with async supportAUTO
useThrottledRefHistory [blocked]Shorthand for useRefHistory with throttled filterAUTO

Elements

FunctionDescriptionInvocation
useActiveElement [blocked]Reactive document.activeElementAUTO
useDocumentVisibility [blocked]Reactively track document.visibilityStateAUTO
useDraggable [blocked]Make elements draggableAUTO
useDropZone [blocked]Create a zone where files can be droppedAUTO
useElementBounding [blocked]Reactive bounding box of an HTML elementAUTO
useElementSize [blocked]Reactive size of an HTML elementAUTO
useElementVisibility [blocked]Tracks the visibility of an element within the viewportAUTO
useIntersectionObserver [blocked]Detects changes to a target element's visibilityAUTO
useMouseInElement [blocked]Reactive mouse position related to an elementAUTO
useMutationObserver [blocked]Watch for changes being made to the DOM treeAUTO
useParentElement [blocked]Get parent element of the given elementAUTO
useResizeObserver [blocked]Reports changes to the dimensions of an Element's content or the border-boxAUTO
useWindowFocus [blocked]Reactively track window focus with window.onfocus and window.onblur eventsAUTO
useWindowScroll [blocked]Reactive window scrollAUTO
useWindowSize [blocked]Reactive window sizeAUTO

Browser

FunctionDescriptionInvocation
useBluetooth [blocked]Reactive Web Bluetooth APIAUTO
useBreakpoints [blocked]Reactive viewport breakpointsAUTO
useBroadcastChannel [blocked]Reactive BroadcastChannel APIAUTO
useBrowserLocation [blocked]Reactive browser locationAUTO
useClipboard [blocked]Reactive Clipboard APIAUTO
useClipboardItems [blocked]Reactive Clipboard APIAUTO
useColorMode [blocked]Reactive color mode (dark / light / customs) with auto data persistenceAUTO
useCssSupports [blocked]SSR compatible and reactive CSS.supportsAUTO
useCssVar [blocked]Manipulate CSS variablesAUTO
useDark [blocked]Reactive dark mode with auto data persistenceAUTO
useEventListener [blocked]Use EventListener with easeAUTO
useEyeDropper [blocked]Reactive EyeDropper APIAUTO
useFavicon [blocked]Reactive faviconAUTO
useFileDialog [blocked]Open file dialog with easeAUTO
useFileSystemAccess [blocked]Create and read and write local files with FileSystemAccessAPIAUTO
useFullscreen [blocked]Reactive Fullscreen APIAUTO
useGamepad [blocked]Provides reactive bindings for the Gamepad APIAUTO
useImage [blocked]Reactive load an image in the browserAUTO
useMediaControls [blocked]Reactive media controls for both audio and video elementsAUTO
useMediaQuery [blocked]Reactive Media QueryAUTO
useMemory [blocked]Reactive Memory InfoAUTO
useObjectUrl [blocked]Reactive URL representing an objectAUTO
usePerformanceObserver [blocked]Observe performance metricsAUTO
usePermission [blocked]Reactive Permissions APIAUTO
usePreferredColorScheme [blocked]Reactive prefers-color-scheme media queryAUTO
usePreferredContrast [blocked]Reactive prefers-contrast media queryAUTO
usePreferredDark [blocked]Reactive dark theme preferenceAUTO
usePreferredLanguages [blocked]Reactive Navigator LanguagesAUTO
usePreferredReducedMotion [blocked]Reactive prefers-reduced-motion media queryAUTO
usePreferredReducedTransparency [blocked]Reactive prefers-reduced-transparency media queryAUTO
useScreenOrientation [blocked]Reactive Screen Orientation APIAUTO
useScreenSafeArea [blocked]Reactive env(safe-area-inset-*)AUTO
useScriptTag [blocked]Creates a script tagAUTO
useShare [blocked]Reactive Web Share APIAUTO
useSSRWidth [blocked]Used to set a global viewport width which will be used when rendering SSR components that rely on the viewport width like useMediaQuery or useBreakpointsAUTO
useStyleTag [blocked]Inject reactive style element in headAUTO
useTextareaAutosize [blocked]Automatically update the height of a textarea depending on the contentAUTO
useTextDirection [blocked]Reactive dir of the element's textAUTO
useTitle [blocked]Reactive document titleAUTO
useUrlSearchParams [blocked]Reactive URLSearchParamsAUTO
useVibrate [blocked]Reactive Vibration APIAUTO
useWakeLock [blocked]Reactive Screen Wake Lock APIAUTO
useWebNotification [blocked]Reactive NotificationAUTO
useWebWorker [blocked]Simple Web Workers registration and communicationAUTO
useWebWorkerFn [blocked]Run expensive functions without blocking the UIAUTO

Sensors

FunctionDescriptionInvocation
onClickOutside [blocked]Listen for clicks outside of an elementAUTO
onElementRemoval [blocked]Fires when the element or any element containing it is removed from the DOMAUTO
onKeyStroke [blocked]Listen for keyboard keystrokesAUTO
onLongPress [blocked]Listen for a long press on an elementAUTO
onStartTyping [blocked]Fires when users start typing on non-editable elementsAUTO
useBattery [blocked]Reactive Battery Status APIAUTO
useDeviceMotion [blocked]Reactive DeviceMotionEventAUTO
useDeviceOrientation [blocked]Reactive DeviceOrientationEventAUTO
useDevicePixelRatio [blocked]Reactively track window.devicePixelRatioAUTO
useDevicesList [blocked]Reactive enumerateDevices listing available input/output devicesAUTO
useDisplayMedia [blocked]Reactive mediaDevices.getDisplayMedia streamingAUTO
useElementByPoint [blocked]Reactive element by pointAUTO
useElementHover [blocked]Reactive element's hover stateAUTO
useFocus [blocked]Reactive utility to track or set the focus state of a DOM elementAUTO
useFocusWithin [blocked]Reactive utility to track if an element or one of its descendants has focusAUTO
useFps [blocked]Reactive FPS (frames per second)AUTO
useGeolocation [blocked]Reactive Geolocation APIAUTO
useIdle [blocked]Tracks whether the user is being inactiveAUTO
useInfiniteScroll [blocked]Infinite scrolling of the elementAUTO
useKeyModifier [blocked]Reactive Modifier StateAUTO
useMagicKeys [blocked]Reactive keys pressed stateAUTO
useMouse [blocked]Reactive mouse positionAUTO
useMousePressed [blocked]Reactive mouse pressing stateAUTO
useNavigatorLanguage [blocked]Reactive navigator.languageAUTO
useNetwork [blocked]Reactive Network statusAUTO
useOnline [blocked]Reactive online stateAUTO
usePageLeave [blocked]Reactive state to show whether the mouse leaves the pageAUTO
useParallax [blocked]Create parallax effect easilyAUTO
usePointer [blocked]Reactive pointer stateAUTO
usePointerLock [blocked]Reactive pointer lockAUTO
usePointerSwipe [blocked]Reactive swipe detection based on PointerEventsAUTO
useScroll [blocked]Reactive scroll position and stateAUTO
useScrollLock [blocked]Lock scrolling of the elementAUTO
useSpeechRecognition [blocked]Reactive SpeechRecognitionAUTO
useSpeechSynthesis [blocked]Reactive SpeechSynthesisAUTO
useSwipe [blocked]Reactive swipe detection based on TouchEventsAUTO
useTextSelection [blocked]Reactively track user text selection based on Window.getSelectionAUTO
useUserMedia [blocked]Reactive mediaDevices.getUserMedia streamingAUTO

Network

FunctionDescriptionInvocation
useEventSource [blocked]An EventSource or Server-Sent-Events instance opens a persistent connection to an HTTP serverAUTO
useFetch [blocked]Reactive Fetch API provides the ability to abort requestsAUTO
useWebSocket [blocked]Reactive WebSocket clientAUTO

Animation

FunctionDescriptionInvocation
useAnimate [blocked]Reactive Web Animations APIAUTO
useInterval [blocked]Reactive counter that increases on every intervalAUTO
useIntervalFn [blocked]Wrapper for setInterval with controlsAUTO
useNow [blocked]Reactive current Date instanceAUTO
useRafFn [blocked]Call function on every requestAnimationFrameAUTO
useTimeout [blocked]Reactive value that becomes true after a given timeAUTO
useTimeoutFn [blocked]Wrapper for setTimeout with controlsAUTO
useTimestamp [blocked]Reactive current timestampAUTO
useTransition [blocked]Transition between valuesAUTO

Component

FunctionDescriptionInvocation
computedInject [blocked]Combine computed and injectAUTO
createReusableTemplate [blocked]Define and reuse template inside the component scopeAUTO
createTemplatePromise [blocked]Template as PromiseAUTO
templateRef [blocked]Shorthand for binding ref to template elementAUTO
tryOnBeforeMount [blocked]Safe onBeforeMountAUTO
tryOnBeforeUnmount [blocked]Safe onBeforeUnmountAUTO
tryOnMounted [blocked]Safe onMountedAUTO
tryOnScopeDispose [blocked]Safe onScopeDisposeAUTO
tryOnUnmounted [blocked]Safe onUnmountedAUTO
unrefElement [blocked]Retrieves the underlying DOM element from a Vue ref or component instanceAUTO
useCurrentElement [blocked]Get the DOM element of current component as a refAUTO
useMounted [blocked]Mounted state in refAUTO
useTemplateRefsList [blocked]Shorthand for binding refs to template elements and components inside v-forAUTO
useVirtualList [blocked]Create virtual lists with easeAUTO
useVModel [blocked]Shorthand for v-model bindingAUTO
useVModels [blocked]Shorthand for props v-model bindingAUTO

Watch

FunctionDescriptionInvocation
until [blocked]Promised one-time watch for changesAUTO
watchArray [blocked]Watch for an array with additions and removalsAUTO
watchAtMost [blocked]watch with the number of times triggeredAUTO
watchDebounced [blocked]Debounced watchAUTO
watchDeep [blocked]Shorthand for watching value with {deep: true}AUTO
watchIgnorable [blocked]Ignorable watchAUTO
watchImmediate [blocked]Shorthand for watching value with {immediate: true}AUTO
watchOnce [blocked]Shorthand for watching value with { once: true }AUTO
watchPausable [blocked]Pausable watchAUTO
watchThrottled [blocked]Throttled watchAUTO
watchTriggerable [blocked]Watch that can be triggered manuallyAUTO
watchWithFilter [blocked]watch with additional EventFilter controlAUTO
whenever [blocked]Shorthand for watching value to be truthyAUTO

Reactivity

FunctionDescriptionInvocation
computedAsync [blocked]Computed for async functionsAUTO
computedEager [blocked]Eager computed without lazy evaluationAUTO
computedWithControl [blocked]Explicitly define the dependencies of computedAUTO
createRef [blocked]Returns a deepRef or shallowRef depending on the deep paramAUTO
extendRef [blocked]Add extra attributes to RefAUTO
reactify [blocked]Converts plain functions into reactive functionsAUTO
reactifyObject [blocked]Apply reactify to an objectAUTO
reactiveComputed [blocked]Computed reactive objectAUTO
reactiveOmit [blocked]Reactively omit fields from a reactive objectAUTO
reactivePick [blocked]Reactively pick fields from a reactive objectAUTO
refAutoReset [blocked]A ref which will be reset to the default value after some timeAUTO
refDebounced [blocked]Debounce execution of a ref valueAUTO
refDefault [blocked]Apply default value to a refAUTO
refManualReset [blocked]Create a ref with manual reset functionalityAUTO
refThrottled [blocked]Throttle changing of a ref valueAUTO
refWithControl [blocked]Fine-grained controls over ref and its reactivityAUTO
syncRef [blocked]Two-way refs synchronizationAUTO
syncRefs [blocked]Keep target refs in sync with a source refAUTO
toReactive [blocked]Converts ref to reactiveAUTO
toRef [blocked]Normalize value/ref/getter to ref or computedEXPLICIT_ONLY
toRefs [blocked]Extended toRefs that also accepts refs of an objectAUTO

Array

FunctionDescriptionInvocation
useArrayDifference [blocked]Reactive get array difference of two arraysAUTO
useArrayEvery [blocked]Reactive Array.everyAUTO
useArrayFilter [blocked]Reactive Array.filterAUTO
useArrayFind [blocked]Reactive Array.findAUTO
useArrayFindIndex [blocked]Reactive Array.findIndexAUTO
useArrayFindLast [blocked]Reactive Array.findLastAUTO
useArrayIncludes [blocked]Reactive Array.includesAUTO
useArrayJoin [blocked]Reactive Array.joinAUTO
useArrayMap [blocked]Reactive Array.mapAUTO
useArrayReduce [blocked]Reactive Array.reduceAUTO
useArraySome [blocked]Reactive Array.someAUTO
useArrayUnique [blocked]Reactive unique arrayAUTO
useSorted [blocked]Reactive sort arrayAUTO

Time

FunctionDescriptionInvocation
useCountdown [blocked]Reactive countdown timer in secondsAUTO
useDateFormat [blocked]Get the formatted date according to the string of tokens passed inAUTO
useTimeAgo [blocked]Reactive time agoAUTO
useTimeAgoIntl [blocked]Reactive time ago with i18n supportedAUTO

Utilities

FunctionDescriptionInvocation
createDisposableDirective [blocked]Utility for authoring disposable directivesAUTO
createEventHook [blocked]Utility for creating event hooksAUTO
createUnrefFn [blocked]Make a plain function accepting ref and raw values as argumentsAUTO
get [blocked]Shorthand for accessing ref.valueEXPLICIT_ONLY
isDefined [blocked]Non-nullish checking type guard for RefAUTO
makeDestructurable [blocked]Make isomorphic destructurable for object and array at the same timeAUTO
set [blocked]Shorthand for ref.value = xEXPLICIT_ONLY
useAsyncQueue [blocked]Executes each asynchronous task sequentially and passes the current task result to the next taskAUTO
useBase64 [blocked]Reactive base64 transformingAUTO
useCached [blocked]Cache a ref with a custom comparatorAUTO
useCloned [blocked]Reactive clone of a refAUTO
useConfirmDialog [blocked]Creates event hooks to support modals and confirmation dialog chainsAUTO
useCounter [blocked]Basic counter with utility functionsAUTO
useCycleList [blocked]Cycle through a list of itemsAUTO
useDebounceFn [blocked]Debounce execution of a functionAUTO
useEventBus [blocked]A basic event busAUTO
useMemoize [blocked]Cache results of functions depending on arguments and keep it reactiveAUTO
useOffsetPagination [blocked]Reactive offset paginationAUTO
usePrevious [blocked]Holds the previous value of a refAUTO
useStepper [blocked]Provides helpers for building a multi-step wizard interfaceAUTO
useSupported [blocked]SSR compatibility isSupportedAUTO
useThrottleFn [blocked]Throttle execution of a functionAUTO
useTimeoutPoll [blocked]Use timeout to poll somethingAUTO
useToggle [blocked]A boolean switcher with utility functionsAUTO
useToNumber [blocked]Reactively convert a string ref to numberAUTO
useToString [blocked]Reactively convert a ref to stringAUTO

@Electron

FunctionDescriptionInvocation
useIpcRenderer [blocked]Provides ipcRenderer and all of its APIs with Vue reactivityEXTERNAL
useIpcRendererInvoke [blocked]Reactive ipcRenderer.invoke API resultEXTERNAL
useIpcRendererOn [blocked]Use ipcRenderer.on with ease and ipcRenderer.removeListener automatically on unmountedEXTERNAL
useZoomFactor [blocked]Reactive WebFrame zoom factorEXTERNAL
useZoomLevel [blocked]Reactive WebFrame zoom levelEXTERNAL

@Firebase

FunctionDescriptionInvocation
useAuth [blocked]Reactive Firebase Auth bindingEXTERNAL
useFirestore [blocked]Reactive Firestore bindingEXTERNAL
useRTDB [blocked]Reactive Firebase Realtime Database bindingEXTERNAL

@Head

FunctionDescriptionInvocation
createHeadCreate the head manager instance.EXTERNAL
useHeadUpdate head meta tags reactively.EXTERNAL

@Integrations

FunctionDescriptionInvocation
useAsyncValidator [blocked]Wrapper for async-validatorEXTERNAL
useAxios [blocked]Wrapper for axiosEXTERNAL
useChangeCase [blocked]Reactive wrapper for change-caseEXTERNAL
useCookies [blocked]Wrapper for universal-cookieEXTERNAL
useDrauu [blocked]Reactive instance for drauuEXTERNAL
useFocusTrap [blocked]Reactive wrapper for focus-trapEXTERNAL
useFuse [blocked]Easily implement fuzzy search using a composable with Fuse.jsEXTERNAL
useIDBKeyval [blocked]Wrapper for idb-keyvalEXTERNAL
useJwt [blocked]Wrapper for jwt-decodeEXTERNAL
useNProgress [blocked]Reactive wrapper for nprogressEXTERNAL
useQRCode [blocked]Wrapper for qrcodeEXTERNAL
useSortable [blocked]Wrapper for sortableEXTERNAL

@Math

FunctionDescriptionInvocation
createGenericProjection [blocked]Generic version of createProjectionEXTERNAL
createProjection [blocked]Reactive numeric projection from one domain to anotherEXTERNAL
logicAnd [blocked]AND condition for refsEXTERNAL
logicNot [blocked]NOT condition for refEXTERNAL
logicOr [blocked]OR conditions for refsEXTERNAL
useAbs [blocked]Reactive Math.absEXTERNAL
useAverage [blocked]Get the average of an array reactivelyEXTERNAL
useCeil [blocked]Reactive Math.ceilEXTERNAL
useClamp [blocked]Reactively clamp a value between two other valuesEXTERNAL
useFloor [blocked]Reactive Math.floorEXTERNAL
useMath [blocked]Reactive Math methodsEXTERNAL
useMax [blocked]Reactive Math.maxEXTERNAL
useMin [blocked]Reactive Math.minEXTERNAL
usePrecision [blocked]Reactively set the precision of a numberEXTERNAL
useProjection [blocked]Reactive numeric projection from one domain to anotherEXTERNAL
useRound [blocked]Reactive Math.roundEXTERNAL
useSum [blocked]Get the sum of an array reactivelyEXTERNAL
useTrunc [blocked]Reactive Math.truncEXTERNAL

@Motion

FunctionDescriptionInvocation
useElementStyleSync a reactive object to a target element CSS stylingEXTERNAL
useElementTransformSync a reactive object to a target element CSS transform.EXTERNAL
useMotionPutting your components in motion.EXTERNAL
useMotionPropertiesAccess Motion Properties for a target element.EXTERNAL
useMotionVariantsHandle the Variants state and selection.EXTERNAL
useSpringSpring animations.EXTERNAL

@Router

FunctionDescriptionInvocation
useRouteHash [blocked]Shorthand for a reactive route.hashEXTERNAL
useRouteParams [blocked]Shorthand for a reactive route.paramsEXTERNAL
useRouteQuery [blocked]Shorthand for a reactive route.queryEXTERNAL

@RxJS

FunctionDescriptionInvocation
from [blocked]Wrappers around RxJS's from() and fromEvent() to allow them to accept refsEXTERNAL
toObserver [blocked]Sugar function to convert a ref into an RxJS ObserverEXTERNAL
useExtractedObservable [blocked]Use an RxJS Observable as extracted from one or more composablesEXTERNAL
useObservable [blocked]Use an RxJS ObservableEXTERNAL
useSubject [blocked]Bind an RxJS Subject to a ref and propagate value changes both waysEXTERNAL
useSubscription [blocked]Use an RxJS Subscription without worrying about unsubscribing from it or creating memory leaksEXTERNAL
watchExtractedObservable [blocked]Watch the values of an RxJS Observable as extracted from one or more composablesEXTERNAL

@SchemaOrg

FunctionDescriptionInvocation
createSchemaOrgCreate the schema.org manager instance.EXTERNAL
useSchemaOrgUpdate schema.org reactively.EXTERNAL

@Sound

FunctionDescriptionInvocation
useSoundPlay sound effects reactively.EXTERNAL

Run your whole company from one repo you own.

Start with one job and grow from there.