Home / Modern UI / Kanban Board

Kanban Board in JavaScript, Free with Live Demo

Free kanban board in plain JavaScript. Drag cards between columns, add labels and due dates, search, and save automatically with localStorage. Keyboard friendly.

Open live demoDownload HTML fileView code on GitHub
Kanban Board JavaScript project: a Trello style task board with drag and drop

Runs on: HTML Drag and Drop. Drag and drop: desktop browsers. On phones, use the move buttons on each card.

What is the Kanban Board?

A kanban board shows work as cards moving through columns: To do, In progress and Done. This one lets you drag cards between columns, add new ones with labels and due dates, search every column, and it saves everything in your browser.

It uses the built in HTML Drag and Drop API, with a line that shows where a card will land. Every card also has move buttons and arrow key support, so it works for keyboard users and on phones.

Good for

  • Personal task lists
  • Small team planning
  • Content calendars
  • A classic portfolio project done well

What this project does

How it works

  1. Start the dragdragstart stores the card id in dataTransfer and dims the card.
  2. Find the spotdragover compares the mouse position with the middle of each card to show where it will land.
  3. Drop and savedrop moves the card in the data, renders the board again and saves it to localStorage.

The key JavaScript

This is the heart of the project. The full file has the rest, including the screen layout and error handling.

card.addEventListener("dragstart", (e) => {
  e.dataTransfer.setData("text/plain", card.dataset.id);
});
column.addEventListener("dragover", (e) => {
  e.preventDefault();                                   // allow dropping
  const after = [...list.children].find((c) => e.clientY < c.getBoundingClientRect().top + c.offsetHeight / 2);
  list.insertBefore(marker, after ?? null);             // show where it lands
});
column.addEventListener("drop", (e) => {
  moveCard(e.dataTransfer.getData("text/plain"), column.dataset.id, indexOf(marker));
});

How to use it

  1. Click Download HTML file above.
  2. Open the file in a code editor, like VS Code.
  3. Run it from a local server with npx serve . so the camera, microphone and AI features are allowed.
  4. Change the text and colors, then upload it to GitHub Pages, Netlify or your own site. It is one file with no build step.

Questions people ask

How does drag and drop work in plain JavaScript?

Set draggable on the card, save its id in dragstart, call preventDefault in dragover to allow a drop, and move the card in the drop handler.

Does drag and drop work on phones?

The HTML Drag and Drop API is weak on touch screens, so each card has move buttons as well. They work everywhere.

Where is my board saved?

In localStorage in your browser. Use Export to save a JSON copy, and Import to load it on another computer.

More Modern UI projects