> For the complete documentation index, see [llms.txt](https://luffyyy.gitbook.io/beardlib/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://luffyyy.gitbook.io/beardlib/menuui/menuui-imagebutton.md).

# ImageButton

Updated for version 3.36.

**It's recommended to first read about the base item before reading about other items** <https://luffyyy.gitbook.io/beardlib/menuui/menuui-item>

## ImageButton/Image

### Creation

```lua
    MyRandomMenu:ImageButton({
        name = "MyImageButton",
        texture = "path/to/my/texture",
        on_callback = function(item)
            log("I was pressed!")
        end
    })
```

Or if you need a divider type image:

```lua
    MyRandomMenu:Image({
        name = "MyImageButton",
        texture = "path/to/my/texture"
    })
```

### Parameters

| Parameter        | Type            | Description                                                                                                      |
| ---------------- | --------------- | ---------------------------------------------------------------------------------------------------------------- |
| texture          | String/Idstring | Texture of the image                                                                                             |
| texture\_rect    | Table           | Texture rectangle of the image, if used. Pivot points have to be left and top of what you need                   |
| icon\_w          | Number          | Specific width for the image(unlike 'w' which gets subtracted with the x image offset)                           |
| icon\_h          | Number          | Specific height for the image(unlike 'h' which gets subtracted with the y image offset)                          |
| img\_offset      | Table/Number    | Offset for the image, useful if you want to have the image smaller while button itself bigger, defaults to {0,0} |
| img\_offset\_x   | Number          | Specific x offset for the image                                                                                  |
| img\_offset\_y   | Number          | Specific y offset for the image                                                                                  |
| highlight\_image | Boolean         | Should the image change color when highlighting(uses `forground` color)                                          |
| img\_color       | Color           | Color of the image, defaults to `foreground` color                                                               |

### Functions

| Function                                               | Description                                       |
| ------------------------------------------------------ | ------------------------------------------------- |
| SetImage(String/Idstring texture, Table texture\_rect) | Sets a texture and texture rectangle for the item |


---

# 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://luffyyy.gitbook.io/beardlib/menuui/menuui-imagebutton.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.
