# Programmatic control

> For the complete documentation index, see [llms.txt](/llms.txt)

> You can open the feedback modal from your own JavaScript instead of relying on the built-in `<feedback-button>` trigger. This is useful when you want a custom trigger, such as a link, an icon, or a keyboard shortcut.

You can open the feedback modal from your own JavaScript instead of relying on the built-in `<feedback-button>` trigger. This is useful when you want a custom trigger, such as a link, an icon, or a keyboard shortcut.

## The openModal() method

`<feedback-modal>` exposes a public `openModal()` method:

```ts
openModal(): Promise<void>
```

Calling it opens the feedback modal, playing the same entrance animation as when a user clicks a `<feedback-button>`.

`openModal()` is only available on `<feedback-modal>`. `<feedback-button>` doesn't expose this method: it calls `openModal()` on its own internal `<feedback-modal>` element when clicked.

## Usage

To call `openModal()`, get a reference to the `<feedback-modal>` element and call the method on it:

1. Add a `<feedback-modal>` element to your page with an `id` you can select later:

   ```html
   <feedback-modal id="my-feedback-modal" project="YOUR_PROJECT_ID"></feedback-modal>
   ```

2. Add your own trigger element, such as a link or icon:

   ```html
   Give feedback
   ```

3. Get a reference to the `<feedback-modal>` element and call `openModal()` when your trigger is activated:

   ```javascript
   document.addEventListener('DOMContentLoaded', () => { const feedbackModal = document.getElementById('my-feedback-modal');
     const trigger = document.getElementById('custom-feedback-trigger');

     trigger.addEventListener('click', (event) => { event.preventDefault();
       feedbackModal.openModal();});});
   ```

See [Embedded mode](../installation/cdn#embedded-form) if you want the feedback form to display without any trigger at all.
