vThemeButton is a lightweight and customizable Vue component that allows users to switch between light and dark themes in your application. Designed for modern interfaces, it emits the selected theme and integrates seamlessly into any Vue 3 project.
Install with npm or yarn
npm install @todovue/tv-theme-button
yarn add @todovue/tv-theme-button
Import
import TvThemeButton from '@todovue/tv-theme-button'
You can also import it directly in the main.js file, so you don't have to import it in the pages
import { createApp } from "vue";
import App from "./App.vue";
import TvThemeButton from '@todovue/tv-theme-button'
const app = createApp(App);
app.component("TvThemeButton", TvThemeButton);
app.mount("#app");
<template>
<tv-theme-button
@change-theme="changeValue"
/>
</template>
<script setup>
import TvThemeButton from "@todovue/tv-theme-button";
const changeValue = (value) => {
console.log(value); // return light or dark
};
</script>
Name | Description |
---|---|
change-theme | Return the value of the theme selected. |
Clone the repository and install the dependencies
git clone https://github.com/TODOvue/tv-theme-button.git
cd tv-theme-button
yarn install