# onPress

Use the `onPress` event to add an action directly on the widget. This is particularly helpful in scenarios where you do not want to open a jig to perform an action, for example, tapping on a widget opens a URL or a modal.

## Configuration options

| `onPress` | Choose from the provided list of available actions, for example, use the `open-url` action to open a specific URL. |
| --------- | ------------------------------------------------------------------------------------------------------------------ |

## Examples and code snippets

### Widget with onPress

{% columns %}
{% column %}
In this example, tapping on the widget opens the [info-modal](/examples/readme/actions/info-modal.md) to display information regarding Jigx.

**Examples**: See the full example in [GitHub](https://github.com/jigx-com/jigx-samples/blob/main/quickstart/jigx-samples/jigs/widgets/2x2/onpress_4x2.jigx).
{% endcolumn %}

{% column %}

<figure><img src="/files/NysGFILPlWrzESqFOQWf" alt="Widget with onPress" width="188"><figcaption><p>Widget with onPress</p></figcaption></figure>
{% endcolumn %}
{% endcolumns %}

{% code title="grid.jigx" %}

```yaml
  - type: component.grid-item
    options:
      size: "1x1"
      children: 
        type: component.jig-widget
        options:
          jigId: onpress_4x2    
          onPress: 
            type: action.info-modal
            options:
              modal:
                title: Welcome to Jigx
                buttonText: Close
                element: 
                  type: image
                  uri: https://archbee-image-uploads.s3.amazonaws.com/x7vdIDH6-ScTprfmi2XXX/nuSx_84sbGbtJlBxRWI5G_landingpage-s.gif?format=webp&width=1280
```

{% endcode %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.jigx.com/examples/readme/widgets/content-widget-components/onpress.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
