@mothepro/theme-toggle
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

<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

Attribute Type Default Description
persistent boolean false Whether the theme should be saved on reload
theme dark or light light The 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>.

Readme

Keywords

none

Package Sidebar

Install

npm i @mothepro/theme-toggle

Weekly Downloads

1

Version

0.0.2

License

Apache-2.0

Unpacked Size

30.7 kB

Total Files

13

Last publish

Collaborators

  • mothepro