# ModalPromptButton
> Represents a button on a modal prompt displayed to the player.
`gg.lode.lecternapi.api.prompt.ModalPromptButton`
---
## Signature
```java
public record ModalPromptButton(String label, int type, String data, float r, float g, float b)
```
---
## Fields
| Field | Type | Description |
|---|---|---|
| `label` | `String` | The button text displayed to the player. |
| `type` | `int` | The button type: `0` = CLOSE, `1` = LINK, `2` = CONSUMER. |
| `data` | `String` | Empty for CLOSE, a URL for LINK, or a reference string for CONSUMER. |
| `r` | `float` | Red color component (0.0-1.0). |
| `g` | `float` | Green color component (0.0-1.0). |
| `b` | `float` | Blue color component (0.0-1.0). |
---
## Constants
| Constant | Value | Description |
|---|---|---|
| `TYPE_CLOSE` | `0` | Button dismisses the modal. |
| `TYPE_LINK` | `1` | Button opens a URL in the player's browser. |
| `TYPE_CONSUMER` | `2` | Button sends a callback to the server. |
---
## Factory Methods
### close
```java
static ModalPromptButton close(String label, float r, float g, float b)
```
Creates a CLOSE button that simply dismisses the modal.
| Parameter | Type | Description |
|---|---|---|
| `label` | `String` | The button text. |
| `r` | `float` | Red color component (0.0-1.0). |
| `g` | `float` | Green color component (0.0-1.0). |
| `b` | `float` | Blue color component (0.0-1.0). |
---
### link
```java
static ModalPromptButton link(String label, String url, float r, float g, float b)
```
Creates a LINK button that opens a URL in the player's browser, then dismisses the modal.
| Parameter | Type | Description |
|---|---|---|
| `label` | `String` | The button text. |
| `url` | `String` | The URL to open. |
| `r` | `float` | Red color component (0.0-1.0). |
| `g` | `float` | Green color component (0.0-1.0). |
| `b` | `float` | Blue color component (0.0-1.0). |
---
### consumer
```java
static ModalPromptButton consumer(String label, String reference, float r, float g, float b)
```
Creates a CONSUMER button that sends a [[ModalPromptClickEvent]] to the server with the given reference, then dismisses the modal.
| Parameter | Type | Description |
|---|---|---|
| `label` | `String` | The button text. |
| `reference` | `String` | The reference string sent back to the server via `ModalPromptClickEvent`. |
| `r` | `float` | Red color component (0.0-1.0). |
| `g` | `float` | Green color component (0.0-1.0). |
| `b` | `float` | Blue color component (0.0-1.0). |
---
## Example
```java
List<ModalPromptButton> buttons = List.of(
ModalPromptButton.consumer("Accept", "accept", 0.2f, 0.7f, 0.2f),
ModalPromptButton.link("Website", "https://example.com", 0.2f, 0.4f, 0.8f),
ModalPromptButton.close("Dismiss", 0.7f, 0.2f, 0.2f)
);
api.getScreenManager().showModalPrompt(player, "welcome", "Welcome!", "# Hello\n\nWelcome to the server.", buttons);
```
---
## Related Pages
- [[IScreenManager]] — `showModalPrompt()` method
- [[ModalPromptClickEvent]] — Fired when a CONSUMER button is clicked