title | lang | home | heroImage | actionText | actionLink | features | footer | description | meta | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
vue-composable |
en-US |
true |
/assets/logo.svg |
Get Started → |
./composable/ |
|
MIT Licensed | Copyright © 2019-present Carlos Rodrigues |
Vue composition-api composable components |
|
vue-composable
is out-of-box ready to use composition-api generic components.
💯 typescript based composable components and full type support out-of-box.
# install with yarn
yarn add @vue/composition-api vue-composable
# install with npm
npm install @vue/composition-api vue-composable
Check out the examples folder or start hacking on codesandbox.
- Event - Attach event listener to a DOM element
- Mouse Move - Attach
mousemove
listener to a DOM element - Resize - Attach
resize
listener to a DOM element - Scroll - Attach
scroll
listener to a DOM element - onOutsidePress - Execute callback when click is outside of element
- Mouse distance from Element - Distance in pixels from an element center
- useNow : Return reactive custom timer with specified refresh rate
- useDateNow : Returns reactive
Date.now()
with custom refresh rate - usePerformanceNow : Returns reactive
performance.now()
with custom refresh rate
- MatchMedia - reactive
MatchMedia
- Breakpoint - reactive
breakpoints
based onwindow.innerWidth
- Chrome - reactive chrome breakpoints
- TailwindCSS - reactive TailwindCSS breakpoints
- sharedRef - cross-tab reactive
ref
- VModel - helper to wrap model update into a
ref
[vue3 only]
- injectFactory - same as inject but allows you to have a factory as default value
- interval - self-remove
setInterval
on unmount - lockScroll -
lock-scroll
component - refDebounced - debounces the update value of a
ref
- WebStorage - Reactive access to
Storage API
,useLocalStorage
anduseSessionStorage
use this - storage - uses
localStorage
or on safari private it usessessionStorage
- localStorage - Reactive access to a
localStorage
- sessionStorage - Reactive access to a
sessionStorage
- Pagination - Generic reactive pagination controls
- Array Pagination - Array pagination
- Validation - model based validation inspired by vuelidate
- dateTimeFormat - Intl.DateTimeFormat
- numberFormat - Intl.NumberFormat
- currencyFormat - CurrencyFormat with Intl.NumberFormat
- Promise -
Promise
reactive resolve and reject - promiseLazy - Sugar for usePromise
lazy:true
- Cancellable Promise - Allow to cancel promises
- Retry - Provides functionality to retry
promise
- Title - reactive
document.title
- Timeline - Tracks variable history
- Undo - Tracks variable history, to allow
undo
andredo
- valueSync - syncs variables value, across multiple
ref
s
- Fetch - reactive
fetch
wrapper - WebSocket - reactive
WebSocket
wrapper - IntersectionObserver - reactive
IntersectionObserver
- NetworkInformation - reactive
NetworkInformation
wrapper - Online - reactive
navigator.onLine
wrapper - PageVisibility - reactive
Page Visibility API
- Language - reactive
NavigatorLanguage
- BroadcastChannel - reactive
BroadcastChannel API
- Geolocation API
- CSS variables - reactive
CSS variables
- Worker -
Web Worker API
- WorkerFunction - Webworker Function, offload a function to webworker
- share - WebShare API
- Clipboard - Clipboard API
New packages needed
- Axios - @vue-composable/axios reactive
axios
wrapper client - makeAxios - @vue-composable/axios wrap your
axios
instance - useCookie - @vue-composable/cookie
js-cookie
wrapper
<template>
<div>
<p>page {{ currentPage }} of {{ lastPage }}</p>
<p>
<button @click="prev">prev</button>
<button @click="next">next</button>
</p>
<ul>
<li v-for="n in result" :key="n">
{{ n }}
</li>
</ul>
</div>
</template>
<script>
import { useArrayPagination } from "vue-composable";
export default {
setup() {
const array = new Array(1000).fill(0).map((_, i) => i);
const { result, next, prev, currentPage, lastPage } = useArrayPagination(
array,
{
pageSize: 3
}
);
return { result, next, prev, currentPage, lastPage };
}
};
</script>