stefanjudis / sparkly-text

A small web component for making your text spark.
https://www.stefanjudis.com/blog/a-web-component-to-make-your-text-sparkle/
MIT License
211 stars 7 forks source link
custom-elements html-components web-components

sparkly-text

A small zero-dependency Web Component to add sparkles to text fragments.

Examples

<!-- Add sparkles  -->
<sparkly-text>Hello sparkles</sparkly-text>

<!-- Increase the number of sparkles  -->
<sparkly-text number-of-sparkles="5">Hello sparkles</sparkly-text>

<!-- Color the sparkles  -->
<sparkly-text style="--sparkly-text-color: orange">Hello sparkles</sparkly-text>

<!-- Increase the sparkle size  -->
<sparkly-text style="--sparkly-text-size: 2.5em">Hello sparkles</sparkly-text>

Installation

You have a few options (choose one of these):

Usage

<!-- Host yourself -->
<script type="module" src="https://github.com/stefanjudis/sparkly-text/raw/main/sparkly-text.js"></script>
<!-- 3rd party CDN, not recommended for production use -->
<script
  type="module"
  src="https://www.unpkg.com/@stefanjudis/sparkly-text"
></script>
<!-- 3rd party CDN, not recommended for production use -->
<script type="module" src="https://esm.sh/@stefanjudis/sparkly-text"></script>

Kudos

Big thanks goes to Zach Leatherman for all his fancy components such as table-saw.