svelte-attach-sound Svelte Themes

Svelte Attach Sound

Add sound effects to svelte components.

svelte-attach-sound

Add sound effects to svelte components.

Example

<script lang="ts">
  import { sound } from "svelte-attach-sound";
  import click_mp3 from "$lib/assets/click.opus";
</script>

<button {@attach sound({ src: click_mp3, events: ["click"] })}>
  Single click sound
</button>

For a more advanced example look at the playground.

Demo

npm Package

Top categories

Loading Svelte Themes