In this step-by-step guide, learn how you can create a Trello-like project management app quickly and easily using Kendo UI.
This is the first post in a two-part series where you will learn how to build the frontend for a Trello-like app. Our app will have a board with lists and the lists will contain cards. The cards can be dragged and dropped within their list or between lists. And users can create new cards as well as edit the content of existing cards. This kind of app can be customized for many different uses cases like a project management tool for software developers or an issue tracker. Our app will be a todo list built using the Kendo UI ListView
and Sortable
components. Your first task will be to create a board initialized with three lists and a few cards.
Our board is essentially a list view within another list view. The first list view we will create are the containers for the cards. We will create an element with the id
board in the body of our HTML to inject our lists. Inside the component’s parameters, we will specify the data source and the template to initialize the widget. Our dataSource
will be an array of objects that have a listID
and name
attribute. This example creates three lists:
The list template will have a header that displays the value of the name
attribute. Beneath the header will be a container to hold the list of cards. This container will have an id
that uses the value of the listID
attribute. For our example, if the listID
is 1
the element’s id
will become list-1
. We need to give this element an id
so we can reference it when creating the list view for the cards later on. The following is an example of the board’s list template created using a script
block. It should be placed before the script where your component is initialized.
And this is the associated CSS to style the lists:
Next, we will create a ListView
for the cards. A card will have a cardID
and a name
. The name
is the content that will be displayed inside the card. The first step is defining the template. Again, we will use a script
block that’s placed in the body of the HTML.
And this is the additional styles:
For each list in the board, we will create a list view for the cards. We could create a function to loop through the data and create the components. This would be ideal if we had a variable number of lists. For instance, if we allowed users to create lists as well, then we would not be able to hard code each component. We would need to dynamically create the lists and find which cards belong to each list to insert them into the list view. However, since we are working with a fixed number of lists, I will define each component manually.
This is now what our board looks like:
To make our cards draggable and droppable between lists we will use the Sortable
component. Each of these list views will behave the same so we can give them all the same options. First, we will create a variable named sortableOptions
that we will pass to the component’s arguments.
The filter
option is needed to define which items are sortable. The connectWith
option lets us move the cards between the lists. Our placeholder
is an empty card element that is slightly darker than the background to give the appearance of a shadow where the card was moved. And the hint
is a copy of the card element given a slight tilt. The final part is to initialize each card list view as a Sortable
component.
This is what the board looks like while dragging a card:
So far we have created a list view for the lists on the board and the cards in the lists. We also made the cards sortable so we could move them around the lists. We could have also made the lists sortable using much of the same code from the card sortable options. The main fields you would need to change is the filter
option so that it uses the container for the lists and the hint can be a clone of the element.
In the next article we will implement the behavior to add, edit, and remove cards.
Want to start taking advantage of the more than 70+ ready-made Kendo UI components, like the ones here? You can begin a free trial of Kendo UI today and start developing your apps faster.
Looking for UI component to support specific frameworks? Check out Kendo UI for Angular, KendoReact, or Kendo UI for Vue.
Alberta is a software developer and writer from New Orleans. Learn more about Alberta at github.com/albertaw.