A Vue Hook Composable For Playing Sound Effects

Use sound is a lightweight Vue hook tool for playing sound effects on the app, based on the vue composition API and Howler.js.

play sound javascript, javascript play sound onclick, vue play sound onclick, javascript play sound from url, use sound hook

  • 👂 Lets your website communicate using 2 human senses instead of 1
  • 🔥 Built with Vue Composition API
  • ✅ Supports Vue 2 & 3 using vue-demi
  • 🚚 Supports Nuxt using nuxt-use-sound
  • ⚡️ <1kb bytes (gzip) in your bundle! ~10kb loaded async.
  • ✨ Built with TypeScript
  • 🗣 Uses a powerful, battle-tested audio utility: Howler.js

How to make use of it:

Install and download:

# Yarn
$ yarn add @vueuse/sound

$ npm i @vueuse/sound

1. Import the audio link file and the sound effects as follows:

import useSound from 'vue-use-sound'
import buttonSfx from '/path/to/effect.mp3'
export default {
  setup() {
    const [play] = useSound(buttonSfx)
    return {

2. Enable button to play sound effects.

<button @click="play">Play a sound</button>

3. The options are available.

export interface HookOptions {
  volume?: number
  playbackRate?: number
  interrupt?: boolean
  soundEnabled?: boolean
  sprite?: SpriteMap
  onload?: () => void
export interface PlayOptions {
  id?: number
  forceSoundEnabled?: boolean
  playbackRate?: number

Vue Hook For Playing Sound Effects Plugin/Github

See Demo And Download

Official Website(vueuse): Click Here

This superior jQuery/javascript plugin is developed by vueuse. For extra advanced usage, please go to the official website.

Related Posts


How to Create a Simple Cookie Banner Consent Using Bootstrap 4

Cookie Consent Popup Javascript – Quick and simple tutorial for creating a simple Bootstrap cookie banner. If you have a website or blog with people visiting or…


Create Custom HTML Terminals With Pure JavaScript | shell.js

Custom HTML Terminals is A JavaScript library to create HTML terminals on web pages. The shell js JavaScript library offers a straightforward method to create Ubuntu, OS X,…


Bootstrap Alert, Confirm, and Flexible Dialog Boxes | Bootbox

Bootbox.js is a small JavaScript library that allows you to create programming dialogs using Bootstrap templates, without having to worry about creating, managing, or removing any required…


An Accessible Touch-enabled Slider Web Component | fg-carousel

fg-carousel Slider – A simple & modern slider web component to create versatile, accessible, touch-enabled picture carousels utilizing CSS scroll snap, Custom Element, and Intersection Observer API….


A Lightweight and Efficient Tags Input Component in Vanilla JS | tagify

tagify transforms an input field or textarea into a tags component, in an easy and customizable way, with great performance and a small code footprint, full of…


A Lightweight Library to Copy Text to Clipboard | CopyJS

CopyJS is a lightweight JavaScript library that allows you to copy plain text or HTML content to the clipboard. Must Read: Tiny Library for Copy Text In…