0.0.2 • Published 4 years ago

@mothepro/theme-toggle v0.0.2

Weekly downloads
8
License
Apache-2.0
Repository
github
Last release
4 years ago

<theme-toggle>

Web Component to natively change your site's theme

npm Published on webcomponents.org

Install

yarn add @mothepro/theme-toggle

How to Use

AttributeTypeDefaultDescription
persistentbooleanfalseWhether the theme should be saved on reload
themedark or lightlightThe theme to use, this attribute is added to the <body> too
<!-- 
  Import the element.

  The `module` query parameter expands "bare" imports to full unpkg.com urls.
  This means use of an import map isn't needed.
  @see https://unpkg.com#query-params
-->
<script type="module" src="//unpkg.com/@mothepro/theme-toggle/dist/esm/index.js?module"></script>

Click to change theme to
<theme-toggle persistent>
  <u slot="light">dark</u>
  <u slot="dark">light</u>
</theme-toggle>.