vue-composable (v1.0.0-beta.24) is a library of out-of-the-box ready-to-use composable functions for Vue 3 and Vue 2 (with @vue/composition-api). It provides tree-shakable, fully typed TypeScript composables for events (mouse move, resize, scroll, outside press), DOM (mouse distance from element), dates (now, dateNow, performanceNow), formatting (string format, object path), breakpoints (MatchMedia, Chrome, TailwindCSS responsive breakpoints), and miscellaneous utilities (sharedRef, vModel helper, injectFactory, interval, lockScroll). Its key differentiators from other composable libraries are aggressive tree-shaking to minimize bundle size, Vue Devtools support, and focus on real-world patterns. First beta released in 2020, with ongoing beta releases and no stable release yet. Requires Vue or @vue/composition-api as peer dependency.
npm install vue-composableVerified import paths — ran on the pinned version, not inferred.
Demonstrates two composables: useMouseMove tracks cursor position, useNow updates every second. Requires vue/composition-api.
Update imports from 'format' to 'useFormat' and from 'path' to 'usePath'.
Use named imports: `import { useMouseMove } from 'vue-composable'`.Install @vue/composition-api and call `Vue.use(VueCompositionAPI)` before using vue-composable.
Replace `useInterval` with `useTimeout` and set `interval: true` in options.
Check browser compatibility before using sharedRef; consider alternative for SSR or legacy environments.
Install @vue/composition-api and call `Vue.use(VueCompositionAPI)` before mounting the app.
Import 'useFormat' instead of 'format'.
Use named imports: `import { useNow } from 'vue-composable'`.Ensure @vue/composition-api is installed and registered before vue-composable.