Skills
Skill 18 of 19
Apply VueUse composables where appropriate to build concise, maintainable Vue.js / Nuxt features.
9 minutes · 1,932 words · 24 sections
Install
npx skills add antfu/skills --skill vueuse-functionsnpx skills add antfu/skillsThe first command installs just this skill, by the name in its SKILL.md; the second installs the whole repository.
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.
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.mdmay override a function’s defaultInvocationrule.
All functions listed below are part of the VueUse (opens in a new tab) 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.
| Function | Description | Invocation |
|---|---|---|
createGlobalState (opens in a new tab) | Keep states in the global scope to be reusable across Vue instances | AUTO |
createInjectionState (opens in a new tab) | Create global state that can be injected into components | AUTO |
createSharedComposable (opens in a new tab) | Make a composable function usable with multiple Vue instances | AUTO |
injectLocal (opens in a new tab) | Extended inject with ability to call provideLocal to provide the value in the same component | AUTO |
provideLocal (opens in a new tab) | Extended provide with ability to call injectLocal to obtain the value in the same component | AUTO |
useAsyncState (opens in a new tab) | Reactive async state | AUTO |
useDebouncedRefHistory (opens in a new tab) | Shorthand for useRefHistory with debounced filter | AUTO |
useLastChanged (opens in a new tab) | Records the timestamp of the last change | AUTO |
useLocalStorage (opens in a new tab) | Reactive LocalStorage (opens in a new tab) | AUTO |
useManualRefHistory (opens in a new tab) | Manually track the change history of a ref when the user calls commit() | AUTO |
useRefHistory (opens in a new tab) | Track the change history of a ref | AUTO |
useSessionStorage (opens in a new tab) | Reactive SessionStorage (opens in a new tab) | AUTO |
useStorage (opens in a new tab) | Create a reactive ref that can be used to access & modify LocalStorage (opens in a new tab) or SessionStorage (opens in a new tab) | AUTO |
useStorageAsync (opens in a new tab) | Reactive Storage with async support | AUTO |
useThrottledRefHistory (opens in a new tab) | Shorthand for useRefHistory with throttled filter | AUTO |
| Function | Description | Invocation |
|---|---|---|
useActiveElement (opens in a new tab) | Reactive document.activeElement | AUTO |
useDocumentVisibility (opens in a new tab) | Reactively track document.visibilityState (opens in a new tab) | AUTO |
useDraggable (opens in a new tab) | Make elements draggable | AUTO |
useDropZone (opens in a new tab) | Create a zone where files can be dropped | AUTO |
useElementBounding (opens in a new tab) | Reactive bounding box (opens in a new tab) of an HTML element | AUTO |
useElementSize (opens in a new tab) | Reactive size of an HTML element | AUTO |
useElementVisibility (opens in a new tab) | Tracks the visibility of an element within the viewport | AUTO |
useIntersectionObserver (opens in a new tab) | Detects changes to a target element’s visibility | AUTO |
useMouseInElement (opens in a new tab) | Reactive mouse position related to an element | AUTO |
useMutationObserver (opens in a new tab) | Watch for changes being made to the DOM tree | AUTO |
useParentElement (opens in a new tab) | Get parent element of the given element | AUTO |
useResizeObserver (opens in a new tab) | Reports changes to the dimensions of an Element’s content or the border-box | AUTO |
useWindowFocus (opens in a new tab) | Reactively track window focus with window.onfocus and window.onblur events | AUTO |
useWindowScroll (opens in a new tab) | Reactive window scroll | AUTO |
useWindowSize (opens in a new tab) | Reactive window size | AUTO |
| Function | Description | Invocation |
|---|---|---|
useEventSource (opens in a new tab) | An EventSource (opens in a new tab) or Server-Sent-Events (opens in a new tab) instance opens a persistent connection to an HTTP server | AUTO |
useFetch (opens in a new tab) | Reactive Fetch API (opens in a new tab) provides the ability to abort requests | AUTO |
useWebSocket (opens in a new tab) | Reactive WebSocket (opens in a new tab) client | AUTO |
| Function | Description | Invocation |
|---|---|---|
useAnimate (opens in a new tab) | Reactive Web Animations API (opens in a new tab) | AUTO |
useInterval (opens in a new tab) | Reactive counter that increases on every interval | AUTO |
useIntervalFn (opens in a new tab) | Wrapper for setInterval with controls | AUTO |
useNow (opens in a new tab) | Reactive current Date instance | AUTO |
useRafFn (opens in a new tab) | Call function on every requestAnimationFrame | AUTO |
useTimeout (opens in a new tab) | Reactive value that becomes true after a given time | AUTO |
useTimeoutFn (opens in a new tab) | Wrapper for setTimeout with controls | AUTO |
useTimestamp (opens in a new tab) | Reactive current timestamp | AUTO |
useTransition (opens in a new tab) | Transition between values | AUTO |
| Function | Description | Invocation |
|---|---|---|
computedInject (opens in a new tab) | Combine computed and inject | AUTO |
createReusableTemplate (opens in a new tab) | Define and reuse template inside the component scope | AUTO |
createTemplatePromise (opens in a new tab) | Template as Promise | AUTO |
templateRef (opens in a new tab) | Shorthand for binding ref to template element | AUTO |
tryOnBeforeMount (opens in a new tab) | Safe onBeforeMount | AUTO |
tryOnBeforeUnmount (opens in a new tab) | Safe onBeforeUnmount | AUTO |
tryOnMounted (opens in a new tab) | Safe onMounted | AUTO |
tryOnScopeDispose (opens in a new tab) | Safe onScopeDispose | AUTO |
tryOnUnmounted (opens in a new tab) | Safe onUnmounted | AUTO |
unrefElement (opens in a new tab) | Retrieves the underlying DOM element from a Vue ref or component instance | AUTO |
useCurrentElement (opens in a new tab) | Get the DOM element of current component as a ref | AUTO |
useMounted (opens in a new tab) | Mounted state in ref | AUTO |
useTemplateRefsList (opens in a new tab) | Shorthand for binding refs to template elements and components inside v-for | AUTO |
useVirtualList (opens in a new tab) | Create virtual lists with ease | AUTO |
useVModel (opens in a new tab) | Shorthand for v-model binding | AUTO |
useVModels (opens in a new tab) | Shorthand for props v-model binding | AUTO |
| Function | Description | Invocation |
|---|---|---|
until (opens in a new tab) | Promised one-time watch for changes | AUTO |
watchArray (opens in a new tab) | Watch for an array with additions and removals | AUTO |
watchAtMost (opens in a new tab) | watch with the number of times triggered | AUTO |
watchDebounced (opens in a new tab) | Debounced watch | AUTO |
watchDeep (opens in a new tab) | Shorthand for watching value with {deep: true} | AUTO |
watchIgnorable (opens in a new tab) | Ignorable watch | AUTO |
watchImmediate (opens in a new tab) | Shorthand for watching value with {immediate: true} | AUTO |
watchOnce (opens in a new tab) | Shorthand for watching value with { once: true } | AUTO |
watchPausable (opens in a new tab) | Pausable watch | AUTO |
watchThrottled (opens in a new tab) | Throttled watch | AUTO |
watchTriggerable (opens in a new tab) | Watch that can be triggered manually | AUTO |
watchWithFilter (opens in a new tab) | watch with additional EventFilter control | AUTO |
whenever (opens in a new tab) | Shorthand for watching value to be truthy | AUTO |
| Function | Description | Invocation |
|---|---|---|
computedAsync (opens in a new tab) | Computed for async functions | AUTO |
computedEager (opens in a new tab) | Eager computed without lazy evaluation | AUTO |
computedWithControl (opens in a new tab) | Explicitly define the dependencies of computed | AUTO |
createRef (opens in a new tab) | Returns a deepRef or shallowRef depending on the deep param | AUTO |
extendRef (opens in a new tab) | Add extra attributes to Ref | AUTO |
reactify (opens in a new tab) | Converts plain functions into reactive functions | AUTO |
reactifyObject (opens in a new tab) | Apply reactify to an object | AUTO |
reactiveComputed (opens in a new tab) | Computed reactive object | AUTO |
reactiveOmit (opens in a new tab) | Reactively omit fields from a reactive object | AUTO |
reactivePick (opens in a new tab) | Reactively pick fields from a reactive object | AUTO |
refAutoReset (opens in a new tab) | A ref which will be reset to the default value after some time | AUTO |
refDebounced (opens in a new tab) | Debounce execution of a ref value | AUTO |
refDefault (opens in a new tab) | Apply default value to a ref | AUTO |
refManualReset (opens in a new tab) | Create a ref with manual reset functionality | AUTO |
refThrottled (opens in a new tab) | Throttle changing of a ref value | AUTO |
refWithControl (opens in a new tab) | Fine-grained controls over ref and its reactivity | AUTO |
syncRef (opens in a new tab) | Two-way refs synchronization | AUTO |
syncRefs (opens in a new tab) | Keep target refs in sync with a source ref | AUTO |
toReactive (opens in a new tab) | Converts ref to reactive | AUTO |
toRef (opens in a new tab) | Normalize value/ref/getter to ref or computed | EXPLICIT_ONLY |
toRefs (opens in a new tab) | Extended toRefs (opens in a new tab) that also accepts refs of an object | AUTO |
| Function | Description | Invocation |
|---|---|---|
useArrayDifference (opens in a new tab) | Reactive get array difference of two arrays | AUTO |
useArrayEvery (opens in a new tab) | Reactive Array.every | AUTO |
useArrayFilter (opens in a new tab) | Reactive Array.filter | AUTO |
useArrayFind (opens in a new tab) | Reactive Array.find | AUTO |
useArrayFindIndex (opens in a new tab) | Reactive Array.findIndex | AUTO |
useArrayFindLast (opens in a new tab) | Reactive Array.findLast | AUTO |
useArrayIncludes (opens in a new tab) | Reactive Array.includes | AUTO |
useArrayJoin (opens in a new tab) | Reactive Array.join | AUTO |
useArrayMap (opens in a new tab) | Reactive Array.map | AUTO |
useArrayReduce (opens in a new tab) | Reactive Array.reduce | AUTO |
useArraySome (opens in a new tab) | Reactive Array.some | AUTO |
useArrayUnique (opens in a new tab) | Reactive unique array | AUTO |
useSorted (opens in a new tab) | Reactive sort array | AUTO |
| Function | Description | Invocation |
|---|---|---|
useCountdown (opens in a new tab) | Reactive countdown timer in seconds | AUTO |
useDateFormat (opens in a new tab) | Get the formatted date according to the string of tokens passed in | AUTO |
useTimeAgo (opens in a new tab) | Reactive time ago | AUTO |
useTimeAgoIntl (opens in a new tab) | Reactive time ago with i18n supported | AUTO |
| Function | Description | Invocation |
|---|---|---|
createDisposableDirective (opens in a new tab) | Utility for authoring disposable directives | AUTO |
createEventHook (opens in a new tab) | Utility for creating event hooks | AUTO |
createUnrefFn (opens in a new tab) | Make a plain function accepting ref and raw values as arguments | AUTO |
get (opens in a new tab) | Shorthand for accessing ref.value | EXPLICIT_ONLY |
isDefined (opens in a new tab) | Non-nullish checking type guard for Ref | AUTO |
makeDestructurable (opens in a new tab) | Make isomorphic destructurable for object and array at the same time | AUTO |
set (opens in a new tab) | Shorthand for ref.value = x | EXPLICIT_ONLY |
useAsyncQueue (opens in a new tab) | Executes each asynchronous task sequentially and passes the current task result to the next task | AUTO |
useBase64 (opens in a new tab) | Reactive base64 transforming | AUTO |
useCached (opens in a new tab) | Cache a ref with a custom comparator | AUTO |
useCloned (opens in a new tab) | Reactive clone of a ref | AUTO |
useConfirmDialog (opens in a new tab) | Creates event hooks to support modals and confirmation dialog chains | AUTO |
useCounter (opens in a new tab) | Basic counter with utility functions | AUTO |
useCycleList (opens in a new tab) | Cycle through a list of items | AUTO |
useDebounceFn (opens in a new tab) | Debounce execution of a function | AUTO |
useEventBus (opens in a new tab) | A basic event bus | AUTO |
useMemoize (opens in a new tab) | Cache results of functions depending on arguments and keep it reactive | AUTO |
useOffsetPagination (opens in a new tab) | Reactive offset pagination | AUTO |
usePrevious (opens in a new tab) | Holds the previous value of a ref | AUTO |
useStepper (opens in a new tab) | Provides helpers for building a multi-step wizard interface | AUTO |
useSupported (opens in a new tab) | SSR compatibility isSupported | AUTO |
useThrottleFn (opens in a new tab) | Throttle execution of a function | AUTO |
useTimeoutPoll (opens in a new tab) | Use timeout to poll something | AUTO |
useToggle (opens in a new tab) | A boolean switcher with utility functions | AUTO |
useToNumber (opens in a new tab) | Reactively convert a string ref to number | AUTO |
useToString (opens in a new tab) | Reactively convert a ref to string | AUTO |
| Function | Description | Invocation |
|---|---|---|
useIpcRenderer (opens in a new tab) | Provides ipcRenderer (opens in a new tab) and all of its APIs with Vue reactivity | EXTERNAL |
useIpcRendererInvoke (opens in a new tab) | Reactive ipcRenderer.invoke API (opens in a new tab) result | EXTERNAL |
useIpcRendererOn (opens in a new tab) | Use ipcRenderer.on (opens in a new tab) with ease and ipcRenderer.removeListener (opens in a new tab) automatically on unmounted | EXTERNAL |
useZoomFactor (opens in a new tab) | Reactive WebFrame (opens in a new tab) zoom factor | EXTERNAL |
useZoomLevel (opens in a new tab) | Reactive WebFrame (opens in a new tab) zoom level | EXTERNAL |
| Function | Description | Invocation |
|---|---|---|
useAuth (opens in a new tab) | Reactive Firebase Auth (opens in a new tab) binding | EXTERNAL |
useFirestore (opens in a new tab) | Reactive Firestore (opens in a new tab) binding | EXTERNAL |
useRTDB (opens in a new tab) | Reactive Firebase Realtime Database (opens in a new tab) binding | EXTERNAL |
| Function | Description | Invocation |
|---|---|---|
createHead (opens in a new tab) | Create the head manager instance. | EXTERNAL |
useHead (opens in a new tab) | Update head meta tags reactively. | EXTERNAL |
| Function | Description | Invocation |
|---|---|---|
createGenericProjection (opens in a new tab) | Generic version of createProjection | EXTERNAL |
createProjection (opens in a new tab) | Reactive numeric projection from one domain to another | EXTERNAL |
logicAnd (opens in a new tab) | AND condition for refs | EXTERNAL |
logicNot (opens in a new tab) | NOT condition for ref | EXTERNAL |
logicOr (opens in a new tab) | OR conditions for refs | EXTERNAL |
useAbs (opens in a new tab) | Reactive Math.abs | EXTERNAL |
useAverage (opens in a new tab) | Get the average of an array reactively | EXTERNAL |
useCeil (opens in a new tab) | Reactive Math.ceil | EXTERNAL |
useClamp (opens in a new tab) | Reactively clamp a value between two other values | EXTERNAL |
useFloor (opens in a new tab) | Reactive Math.floor | EXTERNAL |
useMath (opens in a new tab) | Reactive Math methods | EXTERNAL |
useMax (opens in a new tab) | Reactive Math.max | EXTERNAL |
useMin (opens in a new tab) | Reactive Math.min | EXTERNAL |
usePrecision (opens in a new tab) | Reactively set the precision of a number | EXTERNAL |
useProjection (opens in a new tab) | Reactive numeric projection from one domain to another | EXTERNAL |
useRound (opens in a new tab) | Reactive Math.round | EXTERNAL |
useSum (opens in a new tab) | Get the sum of an array reactively | EXTERNAL |
useTrunc (opens in a new tab) | Reactive Math.trunc | EXTERNAL |
| Function | Description | Invocation |
|---|---|---|
useElementStyle (opens in a new tab) | Sync a reactive object to a target element CSS styling | EXTERNAL |
useElementTransform (opens in a new tab) | Sync a reactive object to a target element CSS transform. | EXTERNAL |
useMotion (opens in a new tab) | Putting your components in motion. | EXTERNAL |
useMotionProperties (opens in a new tab) | Access Motion Properties for a target element. | EXTERNAL |
useMotionVariants (opens in a new tab) | Handle the Variants state and selection. | EXTERNAL |
useSpring (opens in a new tab) | Spring animations. | EXTERNAL |
| Function | Description | Invocation |
|---|---|---|
useRouteHash (opens in a new tab) | Shorthand for a reactive route.hash | EXTERNAL |
useRouteParams (opens in a new tab) | Shorthand for a reactive route.params | EXTERNAL |
useRouteQuery (opens in a new tab) | Shorthand for a reactive route.query | EXTERNAL |
| Function | Description | Invocation |
|---|---|---|
from (opens in a new tab) | Wrappers around RxJS’s from() (opens in a new tab) and fromEvent() (opens in a new tab) to allow them to accept refs | EXTERNAL |
toObserver (opens in a new tab) | Sugar function to convert a ref into an RxJS Observer (opens in a new tab) | EXTERNAL |
useExtractedObservable (opens in a new tab) | Use an RxJS Observable (opens in a new tab) as extracted from one or more composables | EXTERNAL |
useObservable (opens in a new tab) | Use an RxJS Observable (opens in a new tab) | EXTERNAL |
useSubject (opens in a new tab) | Bind an RxJS Subject (opens in a new tab) to a ref and propagate value changes both ways | EXTERNAL |
useSubscription (opens in a new tab) | Use an RxJS Subscription (opens in a new tab) without worrying about unsubscribing from it or creating memory leaks | EXTERNAL |
watchExtractedObservable (opens in a new tab) | Watch the values of an RxJS Observable (opens in a new tab) as extracted from one or more composables | EXTERNAL |
| Function | Description | Invocation |
|---|---|---|
createSchemaOrg (opens in a new tab) | Create the schema.org manager instance. | EXTERNAL |
useSchemaOrg (opens in a new tab) | Update schema.org reactively. | EXTERNAL |
| Function | Description | Invocation |
|---|---|---|
useSound (opens in a new tab) | Play sound effects reactively. | EXTERNAL |
skills/vueuse-functions/SKILL.mdmain, last pushed 23 June 2026.SKILL.md, not by matching a directory convention. One layout observed: skills/*/SKILL.md.h1 and no skipped levels:/antfu/skills.md, and each skill at its own .md URL.268 files · 601 KB
Everything this skill ships beside its prose. All of it is set here, as subchapters of skill 18.
Documentation the agent loads on demand, rather than up front.
Everything else published alongside the skill.