Category: UI Widgets

This solution is summarized from an archived support forum post. This information may have changed. If you notice an error, please let us know in Discord.

Can Appsmith remove widgets programmatically?


I am having trouble adding and removing a time-picker widget in Appsmith to display when something is loading. I want to add it to a container and remove it when the loading is complete. I am wondering if it's possible in Appsmith and if there's a recommended way to add a loading/wait widget.


The solution involves adding a loading spinner or widget to the page while waiting for data to load. This can be done by creating a container for the spinner and conditionally rendering it based on the loading state of the page or data.

In Appsmith, the loading spinner can be added as a widget and then hidden or shown using the visible property. Here's an example code snippet for adding and removing the spinner:

// Add spinner to container
const spinner = createSpinner();

// Show spinner
$w('#spinner').visible = true;

// Remove spinner

The createSpinner() function is a custom function that returns a spinner widget, and the $w object is used to interact with the Appsmith UI components.

This approach can also be adapted to use other types of loading widgets, such as progress bars or animated illustrations. By controlling the visibility of these widgets, the user can be notified when content is loading without disrupting their experience.