1.0.2 • Published 5 years ago
@vaadin-component-factory/vcf-dark-mode-switch v1.0.2
<vcf-dark-mode-switch>
Demo
https://vcf-dark-mode-switch.netlify.com/
Installation
Install vcf-dark-mode-switch:
npm i @vaadin-component-factory/vcf-dark-mode-switch --saveUsage
Once installed, import it in your application:
import '@vaadin-component-factory/vcf-dark-mode-switch';And use it:
<vcf-dark-mode-switch></vcf-dark-mode-switch>You can provide a label via a label attribute.
By toggling the dark mode switch:
- A
theme="dark"attribute will be toggled on thehtmltag. - The user's preference will be persisted on
localStoragewith a keyvcf-dark-mode. - On page refresh, the persisted user's preference will be applied.
Note that the component applies dark mode preference from the OS level if the user's preference is not set.
Running demo
Fork the
vcf-dark-mode-switchrepository and clone it locally.Make sure you have npm installed.
When in the
vcf-dark-mode-switchdirectory, runnpm installto install dependencies.Run
npm startto open the demo.
Contributing
To contribute to the component, please read the guideline first.
License
Apache License 2.0