Giter VIP home page Giter VIP logo

vueuse's Introduction

logo

NPM version Storybook Demos Deploys by Netlify NPM Downloads GitHub last commit GitHub issues GitHub stars

Collection of essential Vue Composition API (inspired by react-use)

๐Ÿš€ Features

  • โšก 0 dependencies: No worry about your bundle size
  • ๐ŸŒด Fully tree shakable: Only take what you want
  • ๐Ÿฆพ Type Strong: Written in Typescript
  • ๐Ÿ•ถ Seamless migration: Works for both Vue 3 and 2
  • ๐ŸŒŽ Browser compatible: Use it though CDN
  • ๐ŸŽช Interactive docs & demos: Check out the Storybook!
  • ๐Ÿ”Œ Optional Add-ons: Firebase, vue-i18n, etc

๐Ÿฆ„ Usage

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

new Vue({
  setup() {
    // tracks mouse position
    const { x, y } = useMouse()

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

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

    return { x, y, isDark, state }
  }
})

Refer to functions list or documentations for more details.

๐Ÿ“ฆ Install

๐ŸŽฉ From v4.0, it works for Vue 2 & 3 within a single package by the power of Vue Demi!

npm i @vueuse/core # yarn add @vueuse/core

Vue 3 Demo: Vite, Webpack / Vue 2 Demo: Vue CLI

CDN

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

It will be exposed to global as window.VueUse

โšก Functions

You can check out the full documents and live demos in Storybook.

More functions to be added. Please keep turned. (PRs are also welcome!)

๐Ÿ”Œ Add-ons

The core package aims to be lightweight and dependence free. While the add-ons are wrapping popular packages into the consistent API style.

๐Ÿงฑ Contribute

See the Contributing Guide

๐ŸŒธ Thanks

This project is heavily inspired by the following awesome projects.

Thanks!

๐Ÿ‘จโ€๐Ÿš€ Contributors

Code Contributors

This project exists thanks to all the people who contribute. [Contribute].

Financial Contributors

Become a financial contributor and help us sustain our community. [Contribute]

Individuals

Organizations

Support this project with your organization. Your logo will show up here with a link to your website. [Contribute]

๐Ÿ“„ License

MIT License ยฉ 2019-2020 Anthony Fu

vueuse's People

Contributors

antfu avatar renovate[bot] avatar scottbedard avatar renovate-bot avatar donskelle avatar joaoeudes7 avatar romansp avatar monkeywithacupcake avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.