Back to Vueuse

README

README.md

14.3.04.3 KB
Original Source
<p align="center"> <a href="https://github.com/vueuse/vueuse#gh-light-mode-only"> </a> <a href="https://github.com/vueuse/vueuse#gh-dark-mode-only"> </a>

Collection of essential Vue Composition Utilities

</p> <p align="center"> <a href="https://www.npmjs.com/package/@vueuse/core" target="__blank"></a> <a href="https://www.npmjs.com/package/@vueuse/core" target="__blank"></a> <a href="https://app.codecov.io/gh/vueuse/vueuse"></a> <a href="https://vueuse.org" target="__blank"></a>

<a href="https://github.com/vueuse/vueuse" target="__blank"></a>

</p> <p align="center"> <a href="https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg"> </a> </p>

🚀 Features

  • 🎊 Interactive docs & demos
  • ⚡ Fully tree shakeable: Only take what you want, bundle size
  • ðŸĶū Type Strong: Written in TypeScript, with TS Docs
  • 🔋 SSR Friendly
  • 🌎 No bundler required: Usable via CDN
  • ðŸ”Đ Flexible: Configurable event filters and targets
  • 🔌 Optional Add-ons: Router, Firebase, RxJS, etc.

ðŸĶ„ Usage

ts
import { useLocalStorage, useMouse, usePreferredDark } from '@vueuse/core'

const { x, y } = useMouse()

// if user prefers dark theme
const isDark = usePreferredDark()

// persist state in localStorage
const store = useLocalStorage(
  'my-storage',
  {
    name: 'Apple',
    color: 'red',
  },
)

Refer to functions list or documentations for more details.

ðŸ“Ķ Install

From v14.0, VueUse requires Vue v3.5+ From v13.0, VueUse requires Vue v3.3+ From v12.0, VueUse no longer supports Vue 2. Please use v11.x for Vue 2 support.

bash
npm i @vueuse/core

Add ons | Nuxt Module

Demos

CDN

vue
<script src="https://unpkg.com/@vueuse/shared"></script>

<script src="https://unpkg.com/@vueuse/core"></script>

It will be exposed to global as window.VueUse

ðŸŠī Project Activity

ðŸ§ą Contribute

See the Contributing Guide

ðŸŒļ Thanks

This project is heavily inspired by the following awesome projects.

And thanks to all the contributors on GitHub!

ðŸ‘Ļ‍🚀 Contributors

Financial Contributors on Open Collective

<a href="https://opencollective.com/vueuse"></a>

📄 License

MIT License ÂĐ 2019-PRESENT Anthony Fu