vueuse-components-skilld
vueuse/vueuse @vueuse/components
Renderless components for VueUse
Version: 14.2.1 (Feb 2026) Deps: @vueuse/shared@14.2.1, @vueuse/core@14.2.1 Tags: next: 5.0.0 (Jun 2021), alpha: 14.0.0-alpha.3 (Sep 2025), beta: 14.0.0-beta.1 (Sep 2025), latest: 14.2.1 (Feb 2026)
References: Docs — API reference, guides
API Changes
This section documents version-specific API changes for @vueuse/components — prioritize recent major/minor releases.
-
BREAKING:
@vueuse/componentsv14+ requires Vue 3.5+, following core library requirements source -
BREAKING: Renderless components refactored for consistency in v14.0.0. Components like
OnClickOutsideandOnLongPressnow use anoptionsprop for configuration and@triggeremit for actions source -
BREAKING: ESM-only package — CJS build has been dropped since v13.0.0 source
-
DEPRECATED:
VOnClickOutsideis deprecated in favor of the lowercasevOnClickOutsidedirective source -
DEPRECATED:
VOnLongPressis deprecated in favor of the lowercasevOnLongPressdirective source -
NEW:
UseDraggablesupportsautoScrollandrestrictInViewoptions for constrained dragging in v14.2.0 source -
NEW:
UseDraggablesupportsstorageKeyandstorageTypeprops for persistent element position source -
NEW:
vOnKeyStrokedirective added for listening to keyboard events directly on elements -
NEW:
UseIdledefault slot data now includespauseandresumemethods viaStoppableimplementation source -
NEW:
vInfiniteScrollsupports reactivecanLoadMoreoption in v14.1.0 source -
NEW:
UseElementVisibilityaddedinitialValueoption in v14.1.0 source -
NEW:
UseMouseInElementsupports tracking inline-level elements in v14.1.0 source -
NEW:
vIntersectionObservernow supports reactiverootMarginoption in v14.2.0 source -
NEW:
UseOffsetPaginationemitspage-change,page-size-change, andpage-count-changeevents
Also changed: useTransition custom interpolators · refManualReset new function · tryOnScopeDispose failSilently · useAsyncState execute result · useTimeAgoIntl custom units
Best Practices
-
Use the
storage-keyandstorage-typeprops on the<UseDraggable>component to automatically persist element position inlocalStorageorsessionStorageacross sessions source -
Utilize the
ignoreoption inOnClickOutside(component or directive) to pass an array of refs or CSS selectors for elements that should not trigger the handler, essential for complex UIs like nested modals source -
Always provide
#loadingand#errorslots in<UseImage>to prevent layout shifts and handle broken images gracefully, rather than managing loading states manually in the script source -
Prefer
createReusableTemplateover extracting small, repeated UI fragments into separate files to maintain access to local scope variables and avoid tedious prop/emit definitions source -
Provide a generic type to
createReusableTemplate<T>()to enable full TypeScript support and IDE autocompletion for data passed betweenDefineTemplateandReuseTemplatesource -
Use
createTemplatePromiseto call complex UI elements like modals or dialogs as promises, keeping the UI definition in the template while maintaining programmatic control and clean async/await flows source -
Configure
@vueuse/componentsdirectives likev-on-click-outsideorv-on-long-pressusing the[handler, options]array syntax for clean, inline logic without needing a separate setup variable for options source
<div v-if="modal" v-on-click-outside="[closeModal, { ignore: [ignoreElRef] }]">
Hello World
</div>
-
Use the
<UseOffsetPagination>component to handle complex pagination state; it emits clean events (page-change,page-size-change) that are more idiomatic and easier to wire up in templates than manually watching refs source -
Set
detectIframe: trueinonClickOutsideoptions when building global navigation or modals to ensure they close when the user clicks inside an iframe, an edge case often missed in manual implementations source -
Utilize the
asprop on renderable components like<UseElementBounding>or<UseFullscreen>to render them as semantically correct HTML elements (e.g.,section,nav) instead of the defaultdivsource