Skip to content

hexagoncircle/click-spark

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 

Repository files navigation

<click-spark> Web Component

Add a little spark to your clicks. ✨

CodePen demo | Blog post

Install

npm install click-spark

Or you can download the click-spark.js file from this repo and add it to your project.

Usage

Add the custom element wherever we want to see sparks fly.

<script type="module" src="click-spark.js"></script>

<body>
  <!-- only add sparks within this container -->
  <div class="container">
    <click-spark></click-spark>
  </div>

  <!-- sparks appear everywhere we click -->
  <click-spark></click-spark>
</body>

Change spark color

Set a spark color via CSS custom property:

<click-spark style="--click-spark-color: blue"></click-spark>