# rmp::ui::Button

> A button: text, an icon, or both.

Source: https://omardev29.github.io/rmp-docs/reference/classes/rmp-ui-Button.html

struct `#include <rmp/ui.h>` [include/rmp/ui.h:1737](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L1737-L1770)

struct Button

A button: text, an icon, or both.

### `text`

rmp::Text text

field [include/rmp/ui.h:1738](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L1738)

The label; empty for an icon-only button

### `icon`

Picture icon{}

field [include/rmp/ui.h:1739](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L1739)

Shown before the label, or alone

### `icon_size`, `icon_above`, `variant`, `size`, `width`, `height`, `enabled`, `id`, `style`, `on_click`, `on_hover`, `on_unhover`, `on_press`, `on_release`, `on_focus`, `on_blur`

float icon_size = 0

bool icon_above = false

Variant variant = Variant::NORMAL

detail::Sizing size{}

float width = 0

float height = 0

bool enabled = true

std::string id{}

Style style{}

rmp::Callback<> on_click

rmp::Callback<> on_hover

rmp::Callback<> on_unhover

rmp::Callback<> on_press

rmp::Callback<> on_release

rmp::Callback<> on_focus

rmp::Callback<> on_blur

field [include/rmp/ui.h:1742](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L1742)

The icon's height in design units; 0 = the label's type size (or the picture's own height when there is no label).

`icon_above`: True: the icon over the label, as a toolbar tile

`variant`: As `ButtonOptions::style`

`size`: A step or design units, as `ButtonOptions::size`

`width`: > 0 = a fixed width; 0 = as the immediate one

`height`: > 0 = a fixed height

`enabled`: False = drawn disabled; no press, no change, no focus

`id`: As `ButtonOptions::id:` only for two with one label

`style`: Its own look; see Style

`on_click`: Clicked: released on it, or Enter or A with the focus

`on_hover`: The pointer arrived on it

`on_unhover`: ...and left

`on_press`: The pointer went down on it

`on_release`: ...and came up

`on_focus`: The keyboard or gamepad focus arrived

`on_blur`: ...and left

### `show`

bool show()

function [include/rmp/ui.h:1761](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L1761)

Lays it out here, runs the callbacks of what happened, and says whether it was clicked — `if (play.show())` works as well as on_click.

Lays it out here

### `shake`, `hovered`, `pressed`, `focused`

void shake()

bool hovered() const

bool pressed() const

bool focused() const

function [include/rmp/ui.h:1764](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L1764)

Shakes it side to side (its style's Motion), plays its `shake` sound and sends `EventKind::SHAKE:` "that did not work". Starts at the next `show()`.

`shake`: Shakes it, as `Button::shake()` does

`hovered`: The pointer is on it

`pressed`: Held down on it

`focused`: It has the focus

### `ours`

KeptState ours

field [include/rmp/ui.h:1769](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L1769)

What it remembers; read it with the methods above
