Module @minecraft/server-ui - v1.3.0

The @minecraft/server-ui module contains types for expressing simple dialog-based user experiences.

  • ActionFormData contain a list of buttons with captions and images that can be used for presenting a set of options to a player.
  • MessageFormData are simple two-button message experiences that are functional for Yes/No or OK/Cancel questions.
  • ModalFormData allow for a more flexible "questionnaire-style" list of controls that can be used to take input.
const form = new ActionFormData()
.title("Months")
.body("Choose your favorite month!")
.button("January")
.button("February")
.button("March")
.button("April")
.button("May");

form.show(players[0]).then((response) => {
if (response.selection === 3) {
dimension.runCommand("say I like April too!");
}
});

Manifest Details

{
"module_name": "@minecraft/server-ui",
"version": "1.3.0"
}
  • @minecraft/common@1.0.0

{
"module_name": "@minecraft/common",
"version": "1.0.0"
}
  • @minecraft/server@1.3.0

{
"module_name": "@minecraft/server",
"version": "1.3.0"
}

Install type definition for @minecraft/server-ui module using npm:

npm i @minecraft/server-ui@1.3.0

Enumerations

FormCancelationReason
FormRejectReason

Classes

ActionFormData
ActionFormResponse
FormRejectError
FormResponse
MessageFormData
MessageFormResponse
ModalFormData
ModalFormResponse
UIManager

Variables

uiManager