Building a Simple Kanban Board with Drag and Drop in Vue 3 and Tailwind CSS — Part 2: Adding New Tasks
First part: Building a Simple Kanban Board with Drag and Drop in Vue 3 and Tailwind CSS
In the previous part of our series, we focused on building the basic structure of a Kanban Board using Vue 3 and Tailwind CSS. We enabled users to drag and drop tasks across columns representing different stages of project completion. In this part, we will expand our application to allow for the addition of new tasks to the board. We will implement a button that triggers a modal, allowing the user to enter the name of a new task and add it to the task list.
Adding the AddTaskButton Component
The first step in expanding our application is to create the AddTaskButton
component. This component will be responsible for displaying a button that, when clicked, will trigger the modal for adding a new task.
AddTaskButton.vue:
<template>
<button
@click="$emit('openModal')"
class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded"
>
Add New Task
</button>
</template>
In this component, we use the @click
directive to emit an openModal
event to the parent component. This allows us to control the visibility of the…