By Mateusz Jasiński · Updated
Minecraft dialogs: build a dialog GUI on 1.21.6+ and Paper
Filedata/myserver/dialog/rules.jsonFiledata/myserver/dialog/report.jsonCommand/dialog showCommand/dialog show @s myserver:rulesA dialog is a native Minecraft screen, added in Java Edition 1.21.6, with a title, body text, input fields and buttons. It is not a chest menu: players get real text boxes, tick boxes, option lists and sliders, and the buttons run a command or send the answers back to the server. You can define one in a data pack and open it with /dialog show, or build it in code with Paper's dialog API, which arrived in Paper 1.21.7. To see one before you write any of that, draw it in GUI Studio and export the JSON.
Dialogs or chest GUIs
Most server menus are still chest inventories with items in slots, and for a grid of things to click (a shop, a warp list, a kit picker) that is still the right tool. Dialogs are better at the other half of the job:
| Chest GUI | Dialog | |
|---|---|---|
| Typed input | Anvil tricks or chat prompts | A real text field, up to max_length characters |
| Numbers and toggles | One item per value | A slider and a tick box |
| Layout | 9 columns, items only | Text, items, inputs and a row of buttons |
| Minecraft version | Any | 1.21.6 and newer clients |
| Bedrock through Geyser | Chest forms | Bedrock forms, since Geyser 2.8.0 |
Settings, confirmations, reports, rename prompts and rule screens are where dialogs earn their place. A client older than 1.21.6 has no dialog screen at all, so if ViaVersion lets older clients in, keep a fallback. Inventory GUI vs dialog vs cursor menu compares them in more detail and adds cursor menus.
The five dialog types
| Type | What it shows | Footer |
|---|---|---|
minecraft:notice | A message with one button | That button, which is also what Esc does |
minecraft:confirmation | A yes or no question | yes and no, both required |
minecraft:multi_action | A scrollable set of buttons, in columns (2 by default) | Only an exit_action if you set one |
minecraft:server_links | The links the server sends in its server links list | exit_action |
minecraft:dialog_list | Buttons that open other dialogs | exit_action |
Every type takes the same base fields: title (required), external_title, body, inputs, can_close_with_escape (default true), pause (default true, and it only pauses in singleplayer) and after_action (close, none or wait_for_response).
The body is one element or a list of them: minecraft:plain_message for text and minecraft:item to show an item with its tooltip.
Inputs
| Input | Key fields | What the player gets |
|---|---|---|
minecraft:text | max_length (32), initial, multiline | A text box |
minecraft:boolean | initial, on_true, on_false | A tick box |
minecraft:single_option | options with id, display, initial | A button that cycles through options |
minecraft:number_range | start, end, step, initial | A slider |
Every input has a key and a label. The key may only hold letters, digits and _, because it is used as a template argument.
Button actions
| Action | Does |
|---|---|
run_command | Runs command as the player. The leading / is optional |
dynamic/run_command | Fills template with the inputs, $(key) for each, and runs it |
suggest_command | Puts command in the chat box |
open_url | Opens url in the browser |
copy_to_clipboard | Copies value |
show_dialog | Opens another dialog, by id or inline |
custom, dynamic/custom | Sends an id, and for dynamic/custom the inputs, to the server. Vanilla ignores it, plugins read it |
A command from a dialog runs with the player's own permissions. A button cannot make a regular player run an op command, so whatever run_command points at has to be a command that player is allowed to use.
A dialog in a data pack
Dialogs live in data/<namespace>/dialog/<name>.json inside a data pack. A rules screen with one button:
{
"type": "minecraft:notice",
"title": { "text": "Server rules", "color": "gold", "bold": true },
"body": [
{ "type": "minecraft:plain_message", "contents": "1. No cheats, x-ray or duping." },
{ "type": "minecraft:plain_message", "contents": "2. Be decent in chat. No slurs, spam or ads." },
{ "type": "minecraft:plain_message", "contents": "3. Do not grief builds you were not invited to." }
],
"action": { "label": "I agree", "width": 150 }
}A form that collects input and hands it to a command:
{
"type": "minecraft:multi_action",
"title": "Report a player",
"inputs": [
{ "type": "minecraft:text", "key": "name", "label": "Player", "max_length": 16 },
{
"type": "minecraft:single_option",
"key": "reason",
"label": "Reason",
"options": [
{ "id": "cheating", "display": "Cheating", "initial": true },
{ "id": "chat", "display": "Chat abuse" }
]
}
],
"actions": [
{ "label": "Send", "action": { "type": "dynamic/run_command", "template": "report $(name) $(reason)" } }
],
"exit_action": { "label": "Cancel" }
}The report command has to exist on your server; the dialog only types it for the player.
Opening dialogs
Load the data pack
Put the pack in the world's
datapacksfolder and restart the server. Dialogs are one of the data pack parts that/reloaddoes not pick up, the same as dimensions and damage types.Show it
Command/dialog show @s myserver:rulesCommand/dialog show @a myserver:rules
/dialog show @s myserver:rulesopens it for you,/dialog show @a myserver:rulesfor everyone. The command needs permission level 2, so it is for ops, the console, command blocks and functions.Try one without a pack
Command/dialog show
/dialog showalso takes an inline dialog in place of the id, which is the quickest way to test a layout. GUI Studio's "/dialog command" export writes exactly that.Close it from the server
Command/dialog clear @s
/dialog clear @scloses whatever dialog the player has open.
Two tags put dialogs where players find them without a command. Dialogs in #minecraft:pause_screen_additions get a button on the pause menu, and dialogs in #minecraft:quick_actions open with the Quick Actions key, G by default. With several dialogs in one tag the client shows a list to pick from.
Dialogs from a Paper plugin
Paper 1.21.7 added a dialog API, documented on the Paper dialogs page. The simplest dialog there is three lines:
Dialog dialog = Dialog.create(builder -> builder.empty()
.base(DialogBase.builder(Component.text("Title")).build())
.type(DialogType.notice()));
player.showDialog(dialog);A confirmation whose button runs code instead of a command uses a click callback. This is the pattern IgniteSky uses for every destructive action:
ActionButton yes = ActionButton.builder(Component.text("Delete", NamedTextColor.RED))
.action(DialogAction.customClick(
(view, audience) -> {
if (audience instanceof Player clicker) {
clicker.getScheduler().run(plugin, task -> deleteHome(clicker, "base"), null);
}
},
ClickCallback.Options.builder().uses(1).build()))
.build();
ActionButton no = ActionButton.builder(Component.text("Keep it")).build();
Dialog dialog = Dialog.create(builder -> builder.empty()
.base(DialogBase.builder(Component.text("Delete home \"base\"?"))
.body(List.of(DialogBody.plainMessage(Component.text("This cannot be undone."))))
.build())
.type(DialogType.confirmation(yes, no)));
player.showDialog(dialog);Inputs are added with DialogInput.text, DialogInput.bool, DialogInput.singleOption and DialogInput.numberRange on the base builder, and read back in the callback from the DialogResponseView with getText, getBoolean and getFloat. Dialogs registered by id, and the PlayerCustomClickEvent for custom actions, are covered in Paper's docs.
What we ran into building IgniteSky's dialogs:
- Esc on a notice presses its button. The notice's one button is also its exit action. For a form with a submit button, use
multi_actionwithout anexit_action, so Esc closes it without submitting. - Paper checks the initial values. A pre-filled text longer than its
maxLength, or a sliderinitialoutside its range, throws when the dialog is built. Clamp them first. - Keys are strict. Lower-case the input keys and replace anything outside
a-z,0-9and_. - Folia. Show the dialog and run the callback's work on the player's own scheduler, as above. IgniteSky does both, so its dialogs run on Folia unchanged.
- One use per click callback.
uses(1)stops a double click from running a delete twice. - Config keydialogs.enabledKeep a fallback. IgniteSky has a
dialogs.enabledswitch and falls back to chest menus for settings and confirmations when it is off. Its native dialogs section lists which screens use them.
Draw it first in GUI Studio
Writing dialog JSON by hand and reloading to see the result gets slow fast. GUI Studio is a free editor in the browser that draws dialogs and chest menus with the game's own font and item icons:
- Start from a preset: a settings dialog with all four input types, a notice and a confirmation whose yes button runs a command.
- Command/dialog showPaste an existing dialog JSON, or a whole
/dialog showcommand, and it is read back into the editor.server_linksanddialog_listdialogs preview their title and body only. - Command/dialog showExport as dialog JSON for a data pack, or as a
/dialog showcommand to paste in game. - The same tool exports chest menus as DeluxeMenus or IgniteAPI YAML, so one project can hold the dialog and the menu that opens it.
Your work saves in the browser you made it in.
Quick answers
- Which version added dialogs? Java Edition 1.21.6. Paper's Java API for them came in 1.21.7.
- Can players open them without op? Not with
/dialog, it needs level 2. Give them a plugin command, the pause menu tag or the Quick Actions key. - Do Bedrock players see them? Through Geyser, yes, as Bedrock forms.
- Can a dialog show a chest grid? No. Use a chest GUI for grids and open a dialog from one of its buttons for the input part.