> For the complete documentation index, see [llms.txt](https://docs.jigx.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.jigx.com/examples/readme/widgets/content-widget-components/onpress.md).

# 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="https://1414514342-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHcPzbms3kZejTmFd500V%2Fuploads%2FICGs2YNlmzpmytYPTf8e%2FJW-widget-onpress.PNG?alt=media&amp;token=0f7234cc-e3cb-42d4-90b2-ff12219df443" 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
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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 following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `build a script that syncs our docs to a CMS` lets GitBook tailor the answer to that use case.

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.
