How can i add "close" button to an element?

It can be done using Velo.
for example:
You need to created a button that, when clicked, opens a container with some content.
Inside the container should create a button for closing.

This is what it looks like in the editor:

And this is the code:

$w.onReady(function () {
 
});

export function openHiddenContent_click(event) {
    $w('#hiddenContent').show();
}

export function closeButton_click(event) {
    $w('#hiddenContent').hide();
}

And here’s a video that shows how to do it:

API:

Thank you so much.
I just did it succesfully following your instructions.

1 Like