# Components methods

**Component methods** provide you with more flexibility when working with components. Using these methods, you can programmatically open and close components, set new or reset current values, and more. \
Component methods are available under `{{ui.componentName.methodName()}}` , and they can accept parameters and return values. You can see a list of component methods via the **App state** tab in the left side panel.

<figure><img src="https://837703843-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUX6zPRMFFK0yrTghj7cY%2Fuploads%2F1W5Ch72Xn6atfdheYXhl%2FCleanShot%202024-12-06%20at%2011.14.06%402x-min.png?alt=media&#x26;token=996e59e7-9d59-47ab-afb6-c6c538264293" alt=""><figcaption></figcaption></figure>

In this section, we'll explore two cases of using component methods.

## Opening and closing a modal programmatically

When working with a **Modal** component, you may want it to open via custom interaction - on *Button/Table row click* (using component triggers) or from a *custom JavaScript snippet*.&#x20;

For this purpose, you simply need to add a Modal component to your working area and create a **JavaScript Code** action with the following code:

<pre class="language-javascript"><code class="lang-javascript"><strong>{{ui.myCustomModal.open()}} - open a modal
</strong></code></pre>

```javascript
{{ui.myCustomModal.close()}} - close a modal
```

<figure><img src="https://837703843-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUX6zPRMFFK0yrTghj7cY%2Fuploads%2F4G6LuYOiWN5RXSoOQzxw%2FCleanShot%202024-12-05%20at%2012.52.51%402x-min.png?alt=media&#x26;token=5a74cdbf-765c-4342-b129-f8c7404c0896" alt=""><figcaption></figcaption></figure>

## Resetting a form after submission

Now, let's review the case how you can reset a **Form** after creating a record and submitting your changes.

### To reset a form:

1. Add a **Form** to the working area.
2. Navigate to its **Triggers** section and select **Create action** for the **O*****n Submit*** trigger.
3. For the first step, select the **Create Row** action type.
4. Next, add another step to it of the **JavaScript Code** type and specify the following code:

```javascript
{{ui.yourForm.reset()}}
```

Done! Now, after submitting the form, it will return to its default condition.

{% embed url="<https://demo.arcade.software/oOJ0ctKiKHhiFc0UeYty?embed=&embed_desktop=inline&embed_mobile=tab&show_copy_link=true>" %}
