Skip to main content

Mobile apps quickstart

Build your first Retool Mobile app in minutes.

Retool Mobile enables you to quickly build mobile apps using a drag-and-drop interface and mobile component library. You can connect your mobile apps to almost any database and API to Retool, allowing your workforce to interact with your data using native apps for iOS and Android.

This guide explains how to build a product management mobile app on Retool. You can browse through a list of products, presented in a card layout, and select one to update its details.

1. Create a resource

Retool can interact with almost any API or database, and includes native integrations for many different data sources. After you configure a resource, you can build apps using your data.

This guide uses Retool Database as the resource. Retool Database is a fast, secure solution for saving and editing data to use in Retool apps. It combines a PostgreSQL database with a spreadsheet-like interface to manage your data.

To add test data to Retool Database, download this CSV and then follow the steps below.

  1. Log in to Retool. If you don't have an account, sign up for free.
  2. Click the Resources tab, then select Retool Database.
  3. Click Import CSV > Into a new table.
  4. Select the products.csv you downloaded.
  5. Name the table products, and set the id and quantity Field type to int4.
  6. Click Create table.

2. Create a new mobile app

To get started, sign in to your Retool organization and click Create new > Mobile app. Every new mobile app is initially configured with a demo that uses a preconfigured interface and sample data for you to try out. For the purposes of this guide, the demo content will be removed.

When editing a Retool Mobile app, the App IDE renders your mobile app on the canvas and includes panels on the left and right. These panels contain sections for managing your app's overall layout through screens and components.

The App IDE for Retool Mobile

3. Prepare screens

You create multi-page mobile apps by organizing mobile components into separate screens. You can navigate between each screen using the tab bar or by interactions that trigger event handlers, such as pressing a button or selecting an item from a list. The product management app uses two screens, one for displaying products and one for editing the selected product's name.

To configure the screens, rename peopleListScreen to products, and peopleDetailsScreen to editProducts. Update their titles as well, and then delete myProfileScreen.

Each screen has a title to identify which screen a user is currently viewing. This is displayed at the top of the app and in the navigation bar.

4. Get product data

Retool automatically creates a query, getRows, for you to get started. Select the query and in the query editor, write a query to retrieve product data from the products table. Then rename the query to getProducts and click Save & Run.


5. Display products for selection

The Card Collection mobile component presents data using a prebuilt card layout. You can use Card Collection to display product data without needing to build any type of layout.

Make sure the products screen is selected and then click on the collectionView1 component. Retool added this automatically when you created the app.

Retool automatically maps your query's data to present as cards, and populates values based on common usage (e.g., using for the card's title). You can change these values as needed in the Mapped options section of the Inspector. Set the value for Body to Quantity: {{ item.quantity }} and the value for Source (under the Media section) to {{ item.image_url }} to display the product's image.

You can also adjust the style and layout of cards using the Appearance section of the Inspector.

6. Add a product search field

You can add a search box to quickly filter the list of products, making it easier to find what you're looking for. Add a Text Input mobile component to the Products screen, then change its Label to Search.

Retool Mobile organizes mobile components vertically in a column layout by default, with additions displayed at the bottom of the Component section. You can reorder mobile components in the mobile panel using drag-and-drop, which allows you to position the Text Input at the top of the screen.

You can reference values and write JavaScript almost anywhere in your Retool apps. Update getProducts to include the input value when retrieving products:

name ilike {{'%' + textInput1.value + '%'}}

7. Select a product

This mobile app enables users to edit a product's name. When a user selects a product, the app opens the Edit products screen as a modal so the user can update the product's information.

First, configure the app to show Edit products on product selection. Retool uses event handlers to trigger queries or other actions in response to user events, such as selecting a product.

Select collectionView1 within the products screen and open the existing event handler in the Interaction settings of the Inspector. Then make sure the event handler is configured with the following settings.

EventPressTrigger the specified action when the user selects a product.
ActionNavigationPerform the specified navigation.
MethodOpen modalDisplay the Edit products screen as a modal.
ScreeneditProductsThe screen that appears when the user selects a product.

Now, select a product in the collection to navigate to Edit products, which is currently empty. Delete any existing components on this screen using the Components section in the left panel.

Next, add a Text Input mobile component to Edit products and update the following settings using the Inspector. If needed, remove any existing components on this screen.

LabelProduct name
Default value{{ }}

The selectedItem property contains data about the currently selected product in collectionView1. Now when you select a product from the list, the text field displays the name of the selected product.

8. Edit the selected product

Updating a product's name requires a second query to write those changes back to the database. Open the code list and click + to create a new query, then select GUI mode to construct a query that can write data.

TableproductsInteract with the products table.
Action typeUpdate an existing recordUpdate an existing product record.
Filter byid = {{ }}Use the id of the selected product to determine which record to update.
Changesetname : {{ textInput2.value }}Update the name with the current value of textInput2.

Queries can trigger event handlers on success or failure. Add a Success event handler to refresh the product list to reflect the changes:

ActionTrigger queryTrigger the specified query.
QuerygetProductsReload the query that retrieves the list of products.

Add a second Success event handler to take the user back to Products screen. Make sure to save the query again.

ActionNavigationPerform the specified navigation.
MethodBackNavigate back to the first (root) screen.

9. Confirm changes

To update the product name, add a Button mobile component to the Edit Products screen and update its Text setting to Save.

Rather than update the name immediately when a user presses the button, your app can display an action sheet to present a set of options that trigger actions, such as triggering the query to update the product name. Add an event handler to the button and set the Action to Action sheet.

Action sheet to confirm changes

Set the action sheet's Title to Update product name? and Description to Change "{{ }}" to "{{ textInput2.value}}"?. This displays the current name and the updated name entered into the text field.

Click + New to add a menu item that confirms changes.

TitleConfirm changesThe text to display.
ActionTrigger queryTrigger the specified query.
Queryquery2The query that updates the product name.

Add another action to revert the changes entered into the text field.

TextResetThe text to display.
ActionControl componentControl the specified component.
ComponenttextInput2The component to control.
MethodReset valueReset the value of the component.

Test your mobile app

Now that your app is complete, it's time to test it on your mobile device. Click Go to app in the top right to open the mobile app as a progressive web app (PWA). Scan the QR code with your iOS or Android device to launch it in the Retool Mobile app. You use this app to browse and launch any of the mobile apps you build.

If you don't have the app installed already, your device is automatically routed to the iOS App Store or Google Play.

Open mobile apps using the QR code

Wrap up

You've now successfully built a mobile app that retrieves product data and presents it in a card layout, and enables you to select a product and update its name.