HUD and title channels
The HUD is the screen visible most of the time during play. Unlike server forms, the player does not respond, and the server only streams text to the screen. So to draw custom elements on the HUD (toasts, a looked-at block info panel, status lines), the server loads data into the existing text channels, title, subtitle, action bar and scoreboard, and the resource pack's hud_screen.json reads that text and turns it into pictures. This page covers the channels, how to add elements, the format for loading data, and real cases.
1. Data channels
| Channel | Script API | Binding the pack reads | Characteristics |
|---|---|---|---|
| Title | player.onScreenDisplay.setTitle(title, options?) | #hud_title_text_string | Large text in the center. One at a time, shared with other features |
| Subtitle | options.subtitle of setTitle, then updateSubtitle(text) | The variable $subtitle_text that the title factory provides, binding #hud_subtitle_text_string | Text under the title |
| Action bar | setActionBar(text) | Action bar text binding | Text under the title and above the hotbar |
| Scoreboard sidebar | /scoreboard objectives setdisplay sidebar | scoreboard_players collection | Lines remain until changed |
(Source: ms-learn ScreenDisplay, private-research.) Server software (Dragonfly and others) uses the same channels through the SetTitle and SetSubTitle packets or the titleraw command.
1.1 Script API: ScreenDisplay
player.onScreenDisplay is a ScreenDisplay (Source: ms-learn, documentation commit a9fd1c0).
| Method | Meaning |
|---|---|
setTitle(title, options?) | Shows a title. An empty string clears it. title is a string, a RawMessage or an array of them |
updateSubtitle(subtitle) | Changes only the subtitle previously shown with setTitle |
setActionBar(text) | Action bar text (under the title, above the hotbar) |
setHudVisibility(visible, hudElements?) | Hide or restore HUD elements. HudVisibility.Hide = 0, Reset = 1 |
hideAllExcept(hudElements?) | Hides everything except the listed ones |
resetHudElementsVisibility() | Returns everything to default |
getHiddenHudElements() | List of hidden elements |
isForcedHidden(hudElement) | Whether the element is forcibly hidden |
These are the properties of TitleDisplayOptions.
| Property | Meaning |
|---|---|
fadeInDuration | Time to appear (ticks, 20 ticks per second) |
stayDuration | Time to stay (ticks) |
fadeOutDuration | Time to disappear (ticks) |
subtitle? | Subtitle |
HudElement is PaperDoll (0), Armor (1), ToolTips (2), TouchControls (3), Crosshair (4), Hotbar (5), Health (6), ProgressBar (7), Hunger (8), AirBubbles (9), HorseHealth (10), StatusEffects (11), ItemText (12). These methods cannot be called in restricted-execution mode, and setTitle can throw ArgumentOutOfBoundsError, InvalidEntityError and RawMessageError.
const d = player.onScreenDisplay;
d.setTitle("CUSTOMHUD:toast:ready", {
fadeInDuration: 0, stayDuration: 60, fadeOutDuration: 10,
subtitle: "Subtitle"
});
d.updateSubtitle("Updated subtitle"); // afterwards, only the subtitle is updated
d.setHudVisibility(HudVisibility.Hide, [HudElement.PaperDoll, HudElement.Armor]);
Hiding HUD elements (SetHud) hides only the vanilla HUD. Elements a resource pack added to the HUD remain {record} (Source: private research).
2. Adding elements to the HUD
The basic way to put an element into the HUD screen (hud_screen.json) is to insert a control into root_panel with modifications. root_panel is a panel that holds almost everything visible on the HUD (Source: bedrock-wiki, the additional HUD elements document).
"hud_square": {
"type": "image",
"texture": "textures/ui/Black",
"anchor_from": "top_middle",
"anchor_to": "top_middle",
"size": [ 64, 64 ],
"offset": [ 0, 4 ]
},
"hud_text": {
"type": "label",
"text": "hud text",
"anchor_from": "top_right",
"anchor_to": "top_right",
"offset": [ -4, 4 ]
},
"root_panel": {
"modifications": [
{
"array_name": "controls",
"operation": "insert_front",
"value": [
{ "hud_square@hud.hud_square": {} },
{ "hud_text@hud.hud_text": {} }
]
}
]
}
- Match the namespace of the elements listed in
value(@hud.hud_square) to the namespace of the file where the element is defined. If you defined the element in thescoreboardnamespace ofscoreboards.json, it is@scoreboard.hud_square. - If there are many elements, group them in a
panel(hud_elements_panel) and put only that one panel intoroot_panel. If you give the grouping panel nosize, it inherits the size of its parent (root_panel), so the children's anchors and percentage sizes work relative to the HUD screen. insert_frontputs it in front (lower layer) andinsert_backputs it at the back (upper layer).
3. Reading text and turning it into pictures
3.1 Picking a picture by a single digit
To show the matching picture when the title is 1 to 5, merge five controls into one instead of evaluating them separately (Source: bedrock-wiki, best practices document).
{
"binding_type": "view",
"source_property_name": "(((#hud_title_text_string - 0) > 0) and ((#hud_title_text_string - 0) < 6))",
"target_property_name": "#visible"
},
{
"binding_type": "view",
"source_property_name": "('textures/wiki/ui/example_' + #hud_title_text_string)",
"target_property_name": "#texture"
}
3.2 Updating only when a keyword is present and preserving the value (Preserve Title Texts)
The title changes every time a command arrives, so you need a component that makes an element react only to text containing a specific keyword and ignore the rest. The component below uses property_bag so each instance has its own "memory" (#preserved_text), so using it several times on the same screen does not conflict (Source: bedrock-wiki, CC BY 4.0).
"preserved_title_display": {
"$update_string": "update",
"type": "label",
"text": "#text",
"controls": [
{
"data_control": {
"type": "panel",
"size": [0, 0],
"property_bag": { "#preserved_text": "" },
"bindings": [
{ "binding_name": "#hud_title_text_string" },
{
"binding_name": "#hud_title_text_string",
"binding_name_override": "#preserved_text",
"binding_condition": "visibility_changed"
},
{
"binding_type": "view",
"source_property_name": "(not (#hud_title_text_string = #preserved_text) and not ((#hud_title_text_string - $update_string) = #hud_title_text_string))",
"target_property_name": "#visible"
}
]
}
}
],
"bindings": [
{
"binding_type": "view",
"source_control_name": "data_control",
"source_property_name": "(#preserved_text - $update_string)",
"target_property_name": "#text"
}
]
}
It works like this.
- An invisible
data_controlpanel makes the decision.property_bagcreates a local variable, so there is none of the conflict of the old method that usedglobal. - If a new title (differs from the stored value and) contains the keyword, the panel becomes visible for one frame and then hides. The
visibility_changedbinding copies the current title into#preserved_textat that moment. - The label receives the text of the child
data_control's#preserved_textwith the keyword removed as#textand shows it.
4. Toast: showing a notification with a title factory (BedrockAdvancements)
(Source: private research) This is the structure of the advancement-achieved notification toast.
"root_panel": { "modifications": [{ "array_name": "controls", "operation": "insert_front",
"value": [{ "ba_toast_factory@ba_toast.toast_factory": {} }] }] },
"hud_title_text/title_frame": { "modifications": [{ "array_name": "bindings", "operation": "insert_back",
"value": [
{ "binding_name": "#hud_title_text_string" },
{ "binding_type": "view",
"source_property_name": "(not (('%.19s' * #hud_title_text_string) = 'CUSTOMHUD:ba_toast:'))",
"target_property_name": "#visible" } ] }] }
toast_factorycreates one morehud_title_text_factoryand generates atoast_notification. The control is created anew each time a title arrives, so the animation plays from the beginning every time.- The data is
"CUSTOMHUD:ba_toast:" + category(20) + title(200) + icon(200)padded with$. The header translates('ba.toast.' + #toast_category)with alocalize: truelabel (lang:ba.toast.task=§eAdvancement Made!and so on). - Animation chain:
toast_slide_in(offset, out_back, 0.5 seconds), thentoast_wait(4.5 seconds), thentoast_slide_out(in_back, 0.5 seconds). It comes in from off screen withfrom: ["100%c + 40px", 20]. - Sibling scope binding: the child label receives
#toast_title_keyand the like computed by the parent withsource_control_name: "toast_notification"+resolve_sibling_scope: true. Parsing is done once in the parent and the children only reference the result. The icon#visibleis evaluated just once withbinding_condition: "once". - Script: a per-player queue, 110-tick intervals (5.5 seconds of animation), play a sound after
setTitle, and send the next toast when it ends. - Limits: Because the vanilla hiding was applied only to
title_frame, there was a problem where text flashed briefly in the center (fixed in 2.0.5), and since the title channel is only one, if another add-on callssetTitlethe toast disappears. I could not confirm the fix because the 2.0.5 original is unavailable. The title channel is shared with other features, so design assuming it can be overwritten.
5. Looked-at block info panel {record}
This is a HUD panel that shows the name, icon and information of the block you look at on screen (the same as the Java mods WAILA and Jade). The resource pack draws it and the server sends the data as a title string. On servers without the Script API, the server does the line-of-sight tracing, building the title and sending it (Source: private research). A comparison of ways to draw icons and counts, the data format and pack examples are collected in the design document Dynamically drawing item icons and counts on the HUD.
5.1 Loading into the title and subtitle
- Put a long prefix on the title to hide the panel's title, and load the name and info lines after it. The pack's position cut (
'%.Ns' * $var_title_text) matches the prefix length.'%.Ns'cuts by bytes, so keep the front slots that are cut by position in ASCII and put non-ASCII text such as Korean at the very end. - Load icons into the subtitle in fixed-width slots. Fill each slot with the item runtime ID x 65536 as text (fill empty positions with a letter such as
x), and attach letters before and after to preserve the string form. If you send only digits, the block state check, in which the pack treats the subtitle as a string, breaks (gray slot, an "expected a string" warning). - The pack takes the variable
$subtitle_textthat the title factory provides into its own variable$var_subtitle_text("$var_subtitle_text": "$subtitle_text"), cuts slots from it, erases the filler letters, and puts the result in#item_id_auxofproperty_bag. The panel text is also all drawn with this variable. - Send the subtitle before the title. When sending a regular title (level up and so on), pause the panel until that title ends.
- Line-of-sight tracing runs when moving or turning (at most once per 0.1 s) and every 0.2 s, with a ray check (excluding air and liquid) up to 6 blocks from the eyes. Crops are judged as a box (stage + 1) / 8 of a block high, so looking over a short crop hits the block behind it. Blocks without a collision box (flowers and so on) are judged as the whole cell, which matches the client crosshair. Send only what changed and occasionally resend.
- A circular gauge for work in progress can be drawn with custom font glyphs. Put 11 frames in the second row of the glyph page
glyph_E1(U+E110 to U+E11A), and place the character for the current progress in the panel's item line at about 10 px (60% of a slot).
5.2 What to avoid in JSON UI
- To take the slot out with a binding expression (
#hud_subtitle_text_string), put#item_id_aux: 0in the icon'sproperty_bagand bind that expression to#item_id_auxwith a view binding andbinding_condition: "always". This drew the icon (measured, section 3.4 of HUD item icons). The earlier binding setup left the icon empty in every format (cutting, fixed width, adding and subtracting, filling and erasing withx), and the difference from that setup was not checked{unverified}. Taking the slot from the variable$var_subtitle_textalso works. If you send the subtitle as digits only, the block state slot check breaks and an "expected a string" warning appears. - Values turned into numbers do not show in text (
" 219","1,532/4,096"). Send quantity and line text in byte slots that start with§f, and make them a string with'§r' + valueinside a variable expression. Put the count expression in the label's own variables block (an expression in the parent panel or('§r' + $variable)insidetextis not evaluated). - A one-digit numeric flag becomes a number in the pack and text comparison fails. Write flags as letters (
atok) and choose with fixed letters in the variables block, not expressions. - If a binding expression uses no
#bindingat all, a "Must define a source property name" error appears.
6. Sidebar scoreboard as a HUD channel {measured}
The title holds only one at a time, so if you load a feature that uses the title, such as the block info panel, together with text that must always be shown, they overwrite each other. If you split one sidebar scoreboard into HUD parts and draw them, they do not overlap (Source: private research).
- Server: Put a marker (
§d§h§u§d) on the objective name and a partial marker in front of each line. For example:§d§1top left,§d§2top right,§d§3quest title,§d§4quest lines. Line order within a part stays as is. Turn off Dragonfly's leading padding. The client merges lines with the same text, so append§rto tell them apart (up to 15 lines). - Pack:
scoreboards.jsonturns the vanillascoreboard.scoreboard_sidebarinto a full-screen panel, and shows the HUD frame if the objective name has the marker and a plain box (for other boards) if it does not. For each part, place ascoreboard_playerscollection stack (#scoreboard_sidebar_sizeto#collection_length), and the line label is visible only when#player_name_sidebarhas that marker and uses the text with the marker removed. Labels uselocalize: false(going through translation makes the%disappear). - Hidden lines do not take up space in the stack.
- The touch screen (
$touch) draws chat at the top left and the jump and sneak buttons at the middle right, so draw the top-left lines at the top right (right aligned) and put the quest window under them. The experience bar is vanilla as is. - While a form is open, the HUD is not drawn, so to show the same frame behind the form, draw it in the form background too (section 8 of Reskinning).
7. Touch pocket layout {record}
On a touch screen, when the UI profile is pocket, the vanilla HUD draws hearts at the top left and hunger at the top right with not_centered_gui_elements. If those places overlap the server's lines, redefine that version in hud_screen.json and place hearts, armor, hunger, air bubbles and mount hearts above the hotbar (the classic touch layout, the same place as vanilla centered_gui_elements_at_bottom_middle_touch). The hotbar is drawn separately by the pocket layout, so it is not put in, and only the paper doll is left at the top left (Source: private research).
A setup without redefining that panel also exists {code} (not yet checked in game): use path keys to set only the vanilla heart, armor, hunger, air bubble and mount heart renderers to ignored, and insert_back a panel holding the same renderers above the hotbar (the centered_gui_elements_at_bottom_middle_touch position) with modifications. The vanilla controls array is not rewritten, so the paper doll stays at the top left and controls vanilla adds later survive.
8. Drawing items with the HUD subtitle {record}
When carrying item runtime ID x 65536 in the title's subtitle to draw an icon, the icon was drawn when cut with '%.11s' from the variable $subtitle_text that the title factory provides (the pack's alias $var_subtitle_text) and put into #item_id_aux of property_bag. Sending the subtitle as digits only breaks the vanilla block state slot check and gives an "expected a string" warning (Source: private research). Taking the slot from the binding #hud_subtitle_text_string left the icon empty in one setup, and with #item_id_aux: 0 in property_bag and a view binding from #hud_subtitle_text_string to #item_id_aux with binding_condition: "always", the icon was drawn (measured, section 3 of Binding expression caching). The difference between the two setups was not checked {unverified}.
9. Rule summary
- Insert HUD elements into
root_panelwithmodifications. Group several in apanel. - The title channel is a shared resource. Attach a long unique marker (
CUSTOMHUD:...), hide the vanilla title only when it is your own marker, and assume other features can overwrite it. - Put text that must always be shown on the sidebar scoreboard or the action bar, not the title.
- Scoreboard lines with the same text are merged, so tell them apart with an invisible tail such as
§r. - When taking a value out of the subtitle, use the
$subtitle_textvariable, or, for a binding, give it aproperty_bagdefault andbinding_condition: "always". Write one-digit numeric flags as letters. - Even if you hide the vanilla HUD with
SetHud, elements the pack added remain.
10. Example: showing a HUD label only when the prefix matches
This is a minimal resource pack that shows one HUD label only while the title the server sends starts with a fixed prefix, and draws the text after the prefix in the label. The example worked in game with the code below as is {measured} (example measurement record, 2026-11-27 Windows 1.26.65). It is Recipe 8 of Pattern recipes (2) trimmed to fit the rules below.
Rules it relies on: FILE-01, MOD-02, MOD-04, HOST-15, HOST-27, TXT-01, TXT-06, BND-05, BND-09. The rule text is in Screen hosts and data channels (HOST-15, HOST-27), Modifying vanilla screens (MOD-02, MOD-04) and Files and definitions (FILE-01). The measurement record is section 6.2 of Claim measurements.
hud_label_example/
manifest.json
ui/
_ui_defs.json
hud_screen.json
hudlabel.json
manifest.json has a single resources module. The format follows the example in manifest.json and the UUIDs are newly made values.
{
"format_version": 3,
"header": {
"name": "HUD label example",
"description": "Shows a HUD label while the title starts with a fixed prefix",
"uuid": "5d1c8b0e-3f42-4a6b-9c71-0e2a7b9d4f13",
"version": "1.0.0",
"min_engine_version": "1.26.40"
},
"modules": [
{ "type": "resources", "uuid": "b7e94a21-6c3d-4f58-8a0b-1d5e2c7f9a64", "version": "1.0.0" }
],
"metadata": { "authors": ["Example"] }
}
ui/_ui_defs.json registers only the new file hudlabel.json. hud_screen.json is at the same path as vanilla, so it is not registered (FILE-01).
{
"ui_defs": [
"ui/hudlabel.json"
]
}
ui/hudlabel.json holds the label and animation definitions. The prefix hudlabel_demo: is 14 ASCII bytes, so it is cut with '%.14s'. The prefix must be long and unique so it does not collide with another add-on's titles (HOST-15).
{
"namespace": "hudlabel",
"label_box": {
"type": "panel",
"size": [ 160, 16 ],
"anchor_from": "top_middle",
"anchor_to": "top_middle",
"offset": [ 0, 24 ],
"anims": [ "@hudlabel.stay" ],
"controls": [
{
"text": {
"type": "label",
"text": "#body",
"localize": false,
"bindings": [
{ "binding_type": "global", "binding_name": "#hud_title_text_string", "binding_name_override": "#raw" },
{ "binding_type": "view", "source_property_name": "(('%.14s' * #raw) = 'hudlabel_demo:')", "target_property_name": "#visible" },
{ "binding_type": "view", "source_property_name": "(#raw - 'hudlabel_demo:')", "target_property_name": "#body" }
]
}
}
]
},
"stay": { "anim_type": "wait", "duration": 3.0, "next": "@hudlabel.leave" },
"leave": {
"anim_type": "offset",
"easing": "in_back",
"duration": 0.5,
"from": [ 0, 0 ],
"to": [ 0, -40 ],
"destroy_at_end": "hud_title_text"
}
}
ui/hud_screen.json is a copy at the same path as vanilla, so its modifications apply (MOD-02). It changes two places.
{
"hud_title_text": {
"modifications": [
{
"array_name": "bindings",
"operation": "insert_back",
"value": [
{ "binding_type": "global", "binding_name": "#hud_title_text_string" },
{
"binding_type": "view",
"source_property_name": "(not (('%.14s' * #hud_title_text_string) = 'hudlabel_demo:'))",
"target_property_name": "#visible"
}
]
}
]
},
"root_panel": {
"modifications": [
{
"array_name": "controls",
"operation": "insert_back",
"value": [
{
"hudlabel_factory": {
"type": "panel",
"size": [ "100%", "100%" ],
"factory": {
"name": "hud_title_text_factory",
"control_ids": { "hud_title_text": "hud_title_text@hudlabel.label_box" }
}
}
}
]
}
]
}
}
The server sends the text after the prefix, for example player.onScreenDisplay.setTitle("hudlabel_demo:Welcome"). Welcome showed at the top center of the screen and disappeared within about 4 seconds, and the factory-created control was gone after that. The vanilla title did not appear for this prefix. A title without the prefix appeared as in vanilla and the label stayed hidden {measured}. The 0.5-second upward slide was not caught on screenshots.
How the rules map to the code:
- Vanilla
hud_title_texthas nobindingsto begin with, soinsert_backis safe (MOD-04). The hiding binding goes on the wholehud_title_text, not ontitle_frame(HOST-27). - The label is created by a
hud_title_text_factoryin my own layer. One prefix decides both hiding the vanilla title and turning on the label (HOST-15, HOST-27). - A control the factory creates stays after the title ends unless an animation removes it.
destroy_at_endmust equal thecontrol_idskeyhud_title_text(measurement in 6.2). The 3 second wait and 0.5 second move are example values, and their relation to the title'sstaytime was not measured. - Every expression contains a
#property(BND-05). The default of#visibleis true, so if an expression fails the label is always visible. If hiding does not work, suspect the expression first (BND-09). - The label text is a literal, so it has
"localize": false(TXT-01).#bodyis a string with the prefix removed, so the numeric drawing problem (TXT-06) does not occur. To show a number, join it to a string.
Values picked without a basis in the wiki: the label's position and size, and the animation times. Hanging anims on a factory-created panel worked in this setup {measured}. Recipe 8 has the same shape with destroy_at_end destroying the control and is {working pack}.
| id | Source | License | Commit | Accessed |
|---|---|---|---|---|
ms-learn | Minecraft Creator documentation (Microsoft Learn) | CC BY 4.0 (documentation), MIT (code) | a9fd1c0 | 2026-11-13 |
bedrock-wiki | Bedrock Wiki | CC BY 4.0 (docs/licenses/CC-BY-4.0.md in the repository) | 0930b39 | 2026-11-13 |
private-research | Private research (-) | - | 2026-11-13 |