@vueuse/core
A collection of 200+ essential Vue Composition API utilities — from sensors and browser APIs to animations and state helpers.
@vueuse/core
VueA collection of 200+ essential Vue Composition API utilities — from sensors and browser APIs to animations and state helpers.
Fit
Bundle (gzip)
46.7 kB
140.2 kB raw
Install size includes transitive dependencies. Bundle size is gzipped browser payload.
Freshness
The Problem
Vue's Composition API is powerful, but implementing common browser interactions from scratch — detecting when the user goes offline, tracking mouse position, persisting state to localStorage, debouncing inputs, observing element visibility — requires repetitive boilerplate that ends up copy-pasted across projects with subtle bugs in each version.
What It Does
VueUse provides over 200 composables that wrap browser APIs, sensors, animations, and utility patterns into ready-to-use reactive functions. Each composable is tree-shakeable, SSR-compatible, and TypeScript-first. Instead of reimplementing useLocalStorage, useDark, useIntersectionObserver, or useDebounce in every project, you install one package and get them all.
Installation
npm install @vueuse/coreUsage Example
<script setup lang="ts">
import {
useLocalStorage,
useDark,
useToggle,
useIntersectionObserver,
useDebounce,
} from '@vueuse/core';
import { ref } from 'vue';
// Persist user preferences to localStorage — reactive, auto-synced
const theme = useLocalStorage('user-theme', 'light');
// Dark mode toggle that syncs with OS preference
const isDark = useDark();
const toggleDark = useToggle(isDark);
// Lazy-load a section when it scrolls into view
const targetSection = ref<HTMLElement | null>(null);
const isVisible = ref(false);
useIntersectionObserver(targetSection, ([{ isIntersecting }]) => {
isVisible.value = isIntersecting;
});
// Debounced search input — only fires after user stops typing
const searchQuery = ref('');
const debouncedQuery = useDebounce(searchQuery, 300);
</script>
<template>
<button @click="toggleDark()">
{{ isDark ? '☀️ Light' : '🌙 Dark' }} Mode
</button>
<p>Saved theme: {{ theme }}</p>
<div ref="targetSection">
<p v-if="isVisible">Section is visible!</p>
</div>
<input v-model="searchQuery" placeholder="Search..." />
<p>Searching for: {{ debouncedQuery }}</p>
</template>Related packages
A complete component library for Vue 3 with a clean, desktop-oriented design system.
floating-vueVueTooltip, popover, and dropdown directives for Vue 3 — powered by Floating UI with automatic placement and overflow detection.
naive-uiVueFairly complete Vue 3 UI component library — 90+ components with a TypeScript-first design and no dependency on legacy CSS frameworks.
piniaVueThe intuitive, type-safe, and lightweight state management store for Vue — the official successor to Vuex.
@tanstack/vue-queryVuePowerful async state management for Vue — data fetching, caching, background refetching, and server state synchronization.