> For the complete documentation index, see [llms.txt](https://docs.roomle.com/rubens/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.roomle.com/rubens/rubens-products/rubens-configurator/integration/listen-to-events/button-clicks.md).

# Button clicks

You can use the onButtonClicked callback to react on button clicks within the configurator UI. The parameter of the callback is the name of the button which has been clicked.

You can use the UI\_BUTTON enum to get all available button names:

```javascript
export enum UI_BUTTON {
  AR = 'ar',
  PARTLIST = 'partlist',
  MULTISELECT = 'multiselect',
  DIMENSIONS = 'dimensions',
  FULLSCREEN = 'fullscreen',
  RESETCAMERA = 'resetcamera',
  RENDERIMAGE = 'renderimage',
  ADDONS = 'addons',
  REQUESTPRODUCT = 'requestproduct',
  REQUESTPLAN = 'requestplan',
  SAVEDRAFT = 'savedraft',
  STARTCONFIGURE = 'startconfigure',
  PAUSECONFIGURE = 'pauseconfigure',
  EXPORT_3D = 'export3d',
  ROTATE = 'rotate',
  UNDO = 'undo',
  REDO = 'redo'
}
```

Example:

```javascript
configurator.ui.callbacks.onButtonClicked = (name) => {
  console.log('Button clicked: ' + name);
};
```

**It is important that the override function returns `true` because if not, nothing gets returned.** For example if we want to override only the default behaviour of the `Save Draft` button we could write something like this:

```javascript
configurator.ui.callbacks.onButtonClicked = (name) => {
  if (name === 'savedraft') {
    alert('Custom save draft!');
    return true;
  }
  return false;
};
```

You can try and play around with it in the following [Code Sandbox](https://codesandbox.io/p/sandbox/override-button-events-2xnmk3).


---

# 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 current page URL with the `ask` query parameter:

```
GET https://docs.roomle.com/rubens/rubens-products/rubens-configurator/integration/listen-to-events/button-clicks.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.
