Logic & actions
Select a button — or a form's submit button — and the inspector shows When pressed: an ordered list of things that happen.
It's a list rather than a node graph on purpose. Node graphs earn their complexity when logic branches, and form logic almost never does. "When pressed, do these things in order" is the whole model.
The actions
| Action | What it does |
|---|---|
| Open another form | Shows a different form. Ends the sequence. |
| Run a command | Runs a command as the player. The slash is optional. |
| Send a message | Chat or action bar, to this player or everyone. |
| Set a score | Adds to or sets a scoreboard objective, creating it if needed. |
| Give an item | Hands over an item stack. |
| Add or remove a tag | Tags the player — useful for "only once" behaviour. |
| Teleport the player | Absolute (100), relative (~5) or facing-relative (^2). |
| Play a sound | With volume and pitch. |
| Close the form | Ends the sequence. |
Commands run as the player through the scripting API, which means they don't need cheats enabled. That's what makes /canvas:open usable on a survival server.
Order matters
Actions run top to bottom, and opening a form or closing ends the sequence. In game the form is gone at that point, so nothing after it can run. Canvas warns when you have actions stranded after one — it won't stop you, but it will tell you.
Drag the grip handle to reorder.
Using what the player entered
This is the part that makes input forms worth building.
In any command or message field, press Insert value ▾ and pick one of the form's inputs. A chip appears inline, and at run time it's replaced by whatever the player entered.
So a form with a dropdown called Item and a slider called Amount, and a command reading:
give @s {Item} {Amount}
becomes give @s minecraft:diamond 12 when the player picks diamond and drags the slider to 12.
What a chip inserts
Click a chip to change what it contributes. The options only differ for controls where the difference exists:
- Dropdown — the text of the chosen option (
minecraft:diamond), or its number (0,1,2…). Bedrock reports a dropdown as an index, so the text is usually what you want, and it's the default. - Toggle —
true/false,1/0, oron/off. - Text field, slider — one sensible reading, so all three give the same thing.
Chips can only reference inputs in the same form. At run time the values come from that one form's response; a chip pointing anywhere else has nothing to read, and Canvas flags it as an error.
Deleting an input removes the chips that pointed at it, so a command can't silently compile with a hole in it.
Chaining forms
Give a button an Open another form action and pick a destination. The canvas draws an "opens →" chip on that button; click it to jump there.
To make a back button, point a button in the second form at the first. Canvas handles cycles fine.
Trying it
Press Play. The console under the form shows exactly what each action would do, with values already spliced in:
press Pressed "Buy"
command /give @s minecraft:diamond 12
score Add -12 to "money"
message You: §aBought 12 × minecraft:diamond
sound Play "random.orb" (volume 1, pitch 1)
What the console says is what the exported pack does — the editor's interpreter and the shipped runtime are checked against each other by test, so the preview can't quietly disagree with the game.
How players open the menu
Set these in the Inspector with nothing selected, under How players open it. You can enable any combination.
A slash command
/canvas:open opens the start form. /canvas:open shop opens a specific one — the argument is a dropdown of your form names, so it autocompletes in chat.
Registered through Bedrock's custom-command registry with cheatsRequired: false, so it works in survival for any player.
An item
Right-clicking an item opens the menu. Either name a vanilla item (minecraft:compass) which costs no extra files, or let Canvas generate a custom item with its own icon — give it with /give @s canvas:menu.
Right-clicks can fire twice on some clients, so the generated runtime debounces them. One press is one form.
A script event
/scriptevent canvas:open — for command blocks, NPCs, or other packs. Pass a form name as the message to open a specific one.
When a player joins
Opens the start form on first spawn. For a moment after joining the client reports itself busy and drops the form on the floor, so the runtime asks again every half-second for about ten seconds. You don't have to think about it, but that's why it works.
Namespace
The canvas in /canvas:open is your project's namespace. Change it in the Inspector — it also names the folders and texture paths in the exported pack. It's forced to lowercase letters, digits and underscores because the game requires that.
Canvas