1.1.0 • Published 3 years ago

vue-dark-mode-switch v1.1.0

Weekly downloads
32
License
Under WTFPL licen...
Repository
github
Last release
3 years ago

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. initalState props allow to initialize the switch value (optional, default value is false).

<template>
    <DarkModeSwitch @switched="onSwitched" :initialState="isDarkModeEnabled" />
</template>

<script>
	import DarkModeSwitch from 'vue-dark-mode-switch'
    import 'vue-dark-mode-switch/dist/vue-dark-mode-switch.css'

	export default {
		data () {
            return {
                isDarkModeEnabled: true
            }
        },
		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

1.1.0

3 years ago

1.0.7

3 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.0

4 years ago