Spoiler Tag Web Component written in Tram-Deco
<script src="https://unpkg.com/deco-spoiler-tag@1"></script>
<p>
Thorn shouts to the surrounding crowd,
<spoiler-tag>"Soylent Green is people!"</spoiler-tag>
</p>
The component takes in a single slot, which is the hidden content.
You can style the control for the spoiler using ::part(control)::after
.
<style>
spoiler-tag::part(control)::after {
background: green;
color: green;
}
</style>