Appearance
Text & tellraw
text(str) builds one styled span; a message is an array of them.
ts
ctx.tellraw(Selector.allPlayers(), [text("Hi ").color(Color.GOLD), "there"]);| Method | Effect |
|---|---|
.color(Color.GOLD) | colour, or a "#ff8800" hex |
.bold() / .italic() | on (pass false to force off) |
.underlined() / .strikethrough() / .obfuscated() | other styles |
.onClick(event) / .onHover(event) | click action / tooltip |
Style a message
ts
import { Datapack, v26_2, Selector, text, Color } from "helix";
const dp = new Datapack("ui", v26_2);
dp.createFunction("banner").build((ctx) => {
ctx.tellraw(Selector.allPlayers(), [
text("[Trivia] ").color(Color.GOLD).bold(),
text("round starting!").color(Color.GREEN),
]);
});Compiled output - the real files helix emits for the code above:
txt
tellraw @a [{"text":"[Trivia] ","color":"gold","bold":true},{"text":"round starting!","color":"green"}]txt
{
"pack": {
"description": "ui\nCreated using Helix",
"min_format": [
107,
1
],
"max_format": [
107,
1
]
}
}Add click and hover
| Helper | Action |
|---|---|
click.command(node) | run a command (a helix command) |
click.suggest(text) | pre-fill the chat box |
click.url(url) | open a URL |
click.copy(text) | copy to clipboard |
hover.text(parts) | tooltip |
ts
import { Datapack, v26_2, Selector, text, Color, click, hover } from "helix";
const dp = new Datapack("ui", v26_2);
dp.createFunction("menu").build((ctx) => {
ctx.tellraw(Selector.allPlayers(), [
text("[ Teleport to spawn ]")
.color(Color.GREEN)
.onClick(click.suggest("/tp @s 0 100 0"))
.onHover(hover.text(text("Fills the command in for you").color(Color.GRAY))),
]);
});Compiled output - the real files helix emits for the code above:
txt
tellraw @a {"text":"[ Teleport to spawn ]","color":"green","click_event":{"action":"suggest_command","command":"/tp @s 0 100 0"},"hover_event":{"action":"show_text","value":[{"text":"Fills the command in for you","color":"gray"}]}}txt
{
"pack": {
"description": "ui\nCreated using Helix",
"min_format": [
107,
1
],
"max_format": [
107,
1
]
}
}Show a score
A Score can go straight into a message as a live value.
TIP
For a reusable or conditionally built message, use TellrawText and .append(part).