In this article, I will guide you on how to create Toggle button in Vue.js
Prerequisites
- node.js installed
- Tailwind CSS
You can check how to install Tailwind CSS in vue.js from the below link
Create Vue.js Project
To create a Vue.js app, use the following command in the terminal.
Install daisyUI
Install daisyUI using following npm command
Open tailwind.config.js and add following code.
Now right-click on the components folder and add a new component named 'toggledemo.vue'. Now open toggledemo.vue component and add the following code.
Now open App.vue component. Add the following code in App.vue component.
Now run the application by using following command.
![]()
Add the following code in toggledemo.vue component.
![]()
Summary
In this article, we learned how to Create Toggle button in Vue.js