Docs
/
installation
Installation
Running and loving mods
To install, simply run the following command in your terminal:
# Using npm
npm install usemods
# Wrangling yarn
yarn add usemods
# Trying bun
bun add usemodsNuxt
If you are using Nuxt, add the module to auto-import every util plus reactive composables for detections that need listeners (useBreakpoint, useScrollPosition, useWindowSize, and more):
npx nuxi module add usemods-nuxt<script setup>
const breakpoint = useBreakpoint()
const scroll = useScrollPosition()
</script>Next
If you are using Next.js, you can add the module to your next.config.js automagica....just kidding. Next.js doesn't have modules. Live with your choices.
Usage
Once you've installed the package, you can import the functions as you need. We'll add better examples in the future, but hopefully your familiar with the basics.
<!-- Vue -->
<template>
<div>
{{ formatNumber(123456789) }}
</div>
<button @click="copyToClipboard('Hello, world!')">
Copy to clipboard
</button>
</template>
<script setup>
import { copyToClipboard, formatNumber } from 'usemods'
</script>