5-Minute Tutorial: To-Do List
This tutorial will guide you through building a full-stack To-Do List application in just 5 minutes. Through this practical exercise, you will master Momen’s core workflow: Data -> Design -> Logic.
Step 1: Create the Data Table
Every app needs a database to persist information. We’ll start by creating a table for our tasks.
- Click the Data tab in the top navigation bar.
- Click Create Table and name it
task(use lowercase). - Add the following fields to the
tasktable:- Add a field of type Text and name it
title. This will store the task’s content. - Add another field of type Boolean and name it
is_completed. This tracks the completion status.
- Add a field of type Text and name it
Step 2: Build the UI
Next, we’ll design the interface to display our tasks and allow users to interact with them.
- Switch back to the Page module.
- Add a List Component:
- Click the Add Component button in the left sidebar to open the component list.
- Drag and drop a List component from the left component panel onto the canvas, and name it
Task List. - Select the List, go to the right properties panel, and under Data tab, set its Data source to the
tasktable we just created.
- Configure List Items:
- Select the List item component of the Task List.
- Add a Text component. Under Design tab, bind its content to
Task List.current_item.title. - Add a Switch component to the text. Bind its default value to
Task List.current_item.is_completed.
- Add Input Area:
- Above the List, add a View component to wrap the input and button. Name it
Input Area. Set its layout direction to Horizontal. - Inside the Input Area, add a Text Input component for typing new tasks. Name it
Task Input. - Inside the Input Area, add a Button component and change its content to “Add”. Name it
Add Button.
- Above the List, add a View component to wrap the input and button. Name it
Step 3: Configure Logic (Actions)
Our UI is ready, but the buttons don’t do anything yet. We need to add Actions to manipulate the data.
1. Create Task
- Select the Add Button you just created.
- In the right properties panel, go to the Action tab.
- Under the On Click trigger, add an Action: Database -> Insert Data.
- Target table:
task. - Field assignment: Map the
titlefield to the value of Task Input.
- Target table:
- Under the On success branch of the Insert Data action
- Add Reset Input Component Value action and select
Task Input. This clears the text box after a task is added. - Add Refresh action and select
Task List. This will refresh the list to display the newly added task.
2. Update Task Status
- Select the Switch component inside the list template item.
- In the right properties panel, go to the Action tab.
- Under the On Value Change trigger, add an Action: choose Database Operation -> Update Data.
- Target table:
task. - Filter: Set filter to
idequalsTask List.current_item.id(this ensures only the current row is updated). - Field assignment: Map the
is_completedfield to the value of Switch component. This updates the data based on the switch’s status.
- Target table:
Step 4: Preview Your App
Now you can click the Mirror icon in the top navigation bar. In the mirror window, try typing a task in the input box, click add, and toggle the switch to see your fully functional app in action!
Step 5: Publish Your App
Once tested successfully, you can deploy your application.
- Click the Publish icon in the top navigation bar.
- Wait for the build process to complete. Once done, you will receive a URL to share with others.
Step 6: Manage Live Data
- Click the Data tab in the top navigation bar, then switch to the Database sub-tab.
- Click the task table to view and manage live records generated by your application.
Congratulations!
You have just completed the full-stack development cycle from database design to UI building and logic binding. You can use this same pattern to add more advanced features, such as a “Delete Task”.