# Button

> Button runs an action when clicked - saving, resetting, or opening another screen - and is the usual Done entry in a screen's footer.

URL: https://xichil.dev/docs/xis-mvui/v1/widgets/button/ · Updated: 2026-11-06 · Applies to: Fabric, Quilt, Legacy Fabric, Forge, NeoForge, MC 1.7.10 - 26.3

A push button, drawn as the version's vanilla button. Use it for actions, and in the footer for Done.

```java
Button.builder("details")
        .label(Text.translatable("mymod.details", "Details..."))
        .onPress(() -> host.open(detailsScreen(host)))
        .build();

Button.builder("done").label(UiTexts.DONE).onPress(host::back).build();
```

## Builder

| Method | Required | Default | Notes |
| --- | --- | --- | --- |
| `label(Supplier<Text>)` / `label(Text)` | yes | | the text on the button |
| `onPress(Runnable)` | yes | | runs on the main thread when clicked |
| `enabled`, `tooltip`, `visible` | no | | [options every widget has](https://xichil.dev/docs/xis-mvui/v1/widgets/index.md#options-every-widget-has) |

## Behaviour

- After `onPress` returns, the screen refreshes, so labels and enabled states show what the action changed.
- Typical actions change your state, write to a [StatusLine](https://xichil.dev/docs/xis-mvui/v1/widgets/status-line/index.md), or navigate with `host.open`,
  `host.back` or `host.close`.
- Slow work (file or network IO) belongs in `host.runAsync`, never directly in `onPress`.
- If `onPress` throws, the error is logged and the menu stays open.
- Vanilla's convention ends the label of a button that opens a screen with `...`.
- **Footer:** yes.

## Test it

```java
host.click("details");                 // presses it
```

Rendered as `[button details] Details...`.

## See also

- Javadoc: [Button](https://xichil.dev/javadoc/xis-mvui/v1/dev/xichil/mvui/Button.html)
- [Several screens and dialogs](https://xichil.dev/docs/xis-mvui/v1/guides/navigation/index.md)
