Skip to content

ismailnguyen/vue-dark-mode-switch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vue-dark-mode-switch

VueJS Dark mode switch component

Install

npm install --save vue-dark-mode-switch

Usage

Import the DarkModeSwitch component, and it will emit its state through @switched event method.

<template>
    <DarkModeSwitch @switched="onSwitched" />
</template>

<script>
	import DarkModeSwitch from './components/DarkModeSwitch.vue'

	export default {
		components: {
			DarkModeSwitch
		},
		methods: {
			onSwitched: function (isSwitched) {
				console.log('dark mode is enabled :', isSwitched);
			}
		}
	}
</script>

Demo

Live : https://www.ismailnguyen.com

Switch Off

Switch Off

Switch On

Switch On