Components are the elements inside a layout: text, buttons, images, item icons, the player model, and so on. Each entry in a layout's components list is an object with a type field and the type's own settings:
Components are not laid out automatically; each one is positioned on its own. The alignment anchors the component to one of nine points of the layout's padded area, and x/y shift it from there:
top_left top_center top_right
middle_left center middle_right
bottom_left bottom_center bottom_right
For centered alignments the component's own size is taken into account, so "alignment": "center" with no offsets puts the component exactly in the middle. Offsets always move the component right (x) and down (y); use negative values for the other direction. A back button in the bottom right corner, 4 pixels off the edge, would be:
The action property makes buttons do something when pressed. It uses the vanilla dialog action format, so everything vanilla supports works here: minecraft:run_command, minecraft:open_url, minecraft:suggest_command, minecraft:show_dialog, minecraft:copy_to_clipboard, and the dynamic variants.
Palladium adds two more action types:
palladium:open_screen opens another Palladium screen (field screen, the screen ID). This is how you link screens together into multi-page menus.
palladium:open_customization_screen opens the player customization screen (optional field category to jump to a category).
{
"type": "palladium:button",
"text": "Choose your side",
"close_on_press": true,
"properties": {
"action": {
"type": "minecraft:run_command",
"command": "function mypack:choose_side"
}
}
}
Only the two button components (palladium:button and palladium:flat_button) execute actions; on all other components the action property is ignored. Commands run through actions are executed by the player, with their permission level, exactly like the vanilla dialog system.
The visibility property takes the same conditions used everywhere else in Palladium, tested against the viewing player. Since it is re-evaluated every tick while the screen is open, you can build screens that react to the player's state, for example showing a button only once a power is unlocked: