# 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](https://docs.jigx.com/examples/readme/actions/info-modal) 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&#x26;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 %}
