Skip to content

A progressively-enhanced spoiler tag that works in any frontend. Built using web components.

License

Notifications You must be signed in to change notification settings

andrico1234/no-spoilers

Repository files navigation

no-spoilers

A progressively-enhanced spoiler tag that works in any frontend. Built using web components.

Example of no-spoilers

no-spoilers was built for my web component course, Component Odyssey. If you'd like to build your first web component library, then you can register your interest.

Installation

npm i no-spoilers

Usage

<script type="module">
  import "no-spoilers/no-spoilers.js";
</script>

<no-spoilers>
  <details>
    <p>This is a spoiler</p>
  </details>
</no-spoilers>

Note: The details tag is optional but ensures that if the web component fails to load that the spoiler won't be revealed by default. no-spoilers checks to see if a single details element is the only child and if so, it will rmeove the details element and replace it with the details's children.

Attributes

  • button-text - Displays the text on the button that reveals the spoiler. Default: "Reveal Spoiler"

About

A progressively-enhanced spoiler tag that works in any frontend. Built using web components.

Resources

License

Stars

Watchers

Forks

Packages

No packages published