Skip to content
WikilyWIKILY
All games23 Wikis · pick your game
Commands and cheatsAll commands

Switch game

23 Wikis · pick your game
Text Components

Command reference

Text Components

Text components are the formatted text used by /tellraw, /title, signs, item names and entity names. A component is a quoted string, an object in braces with content and styling fields, or a list of components.

Details

Plain textA quoted string: "Hello" or 'Hello'.
Object{text:"Hello",color:"red"}. Field names may be written with or without quotes.
List["A",{text:"B"}]. The first entry is the parent; the others follow it and take over its styling.
Content typestext, translatable, score, selector, keybind, nbt, object. The type is recognized from the fields; a type field is optional.
Color namesblack, dark_blue, dark_green, dark_aqua, dark_red, dark_purple, gold, gray, dark_gray, blue, green, aqua, red, light_purple, yellow, white.
Hex colors# followed by six hex digits, such as #FF8800.
Inherited stylingParts in extra use the styling of their parent unless they set their own.
Click actionsopen_url, run_command, suggest_command, show_dialog, change_page, copy_to_clipboard, custom. open_file is refused in commands.
Hover actionsshow_text, show_item, show_entity.
Line break\n inside quoted text.

Content fields

textShows the given text/tellraw @a {text:"Hello",color:"red"}
translateShows a translated text by its key/tellraw @a {translate:"block.minecraft.stone"}
withValues put into the placeholders of a translated text/tellraw @a {translate:"chat.type.announcement",with:["Server","Hello"]}
fallbackText used when the translation key is unknown/tellraw @a {translate:"my.custom.key",fallback:"Hi %s",with:[{selector:"@s"}]}
scoreShows a score. Needs name (a name or selector) and objective/tellraw @a ["Score: ",{score:{name:"@s",objective:"kills"},color:"gold"}]
selectorShows the names of the selected entities/tellraw @a {selector:"@a",separator:" and "}
separatorText put between several names or values/tellraw @a {selector:"@a",separator:{text:" | ",color:"gray"}}
keybindShows the key the reader has set for a control/tellraw @a {keybind:"key.jump"}
nbtShows a value read from data by a data path/tellraw @a {nbt:"Health",entity:"@s"}
entityReads the nbt value from the selected entities/tellraw @a {nbt:"Pos",entity:"@s",plain:true,separator:", "}
blockReads the nbt value from the block at a position/tellraw @a {nbt:"Items[0].id",block:"~ ~-1 ~"}
storageReads the nbt value from command storage/tellraw @a {nbt:"message",storage:"my_pack:data",interpret:true}
interpretTreats the nbt value as a text component. Cannot be combined with plain/tellraw @a {nbt:"message",storage:"my_pack:data",interpret:true}
plainShows the nbt value without coloring. Cannot be combined with interpret/tellraw @a {nbt:"Pos",entity:"@s",plain:true,separator:", "}
spriteShows a picture from a texture atlas/tellraw @a {sprite:"minecraft:block/diamond_block"}
atlasAtlas the sprite comes from. Default is minecraft:blocks/tellraw @a {atlas:"minecraft:items",sprite:"minecraft:item/diamond"}
playerShows the head of a player skin/tellraw @a {player:{name:"Notch"},hat:false}
hatWhether the hat layer of the head is drawn. Default is true/tellraw @a {player:{name:"Notch"},hat:false}
typeNames the content type outright: text, translatable, score, selector, keybind, nbt or object/tellraw @a {type:"text",text:"Typed"}
extraMore components shown right after this one/tellraw @a {text:"A",color:"red",extra:[{text:"B",bold:true},"C"]}

Styling fields

colorText color, a color name or #RRGGBB/tellraw @a {text:"Hello",color:"#FF8800"}
shadow_colorColor of the text shadow, one number or [red,green,blue,alpha] from 0 to 1/tellraw @a {text:"Hello",shadow_color:[1.0f,0.0f,0.0f,1.0f]}
boldBold text, true or false/tellraw @a {text:"A",color:"red",extra:[{text:"B",bold:true},"C"]}
italicSlanted text, true or false/title @a subtitle {text:"Good luck",italic:true}
underlinedLine under the text, true or false/tellraw @a {text:"Hello",color:"#FF8800",bold:true,italic:true,underlined:true,strikethrough:true,obfuscated:false}
strikethroughLine through the text, true or false/tellraw @a {text:"Hello",color:"#FF8800",bold:true,italic:true,underlined:true,strikethrough:true,obfuscated:false}
obfuscatedScrambled, constantly changing letters, true or false/tellraw @a {text:"Hello",color:"#FF8800",bold:true,italic:true,underlined:true,strikethrough:true,obfuscated:false}
fontId of the font to draw with/tellraw @a {text:"Hello",font:"minecraft:alt"}
insertionText put into the chat box when the text is shift-clicked/tellraw @a {text:"Shift-click me",insertion:"inserted text"}
click_eventWhat happens when the text is clicked/tellraw @a {text:"Click",click_event:{action:"run_command",command:"/say hi"}}
hover_eventWhat is shown when the pointer rests on the text/tellraw @a {text:"Hover",hover_event:{action:"show_text",value:"Tooltip"}}

Click actions

run_commandcommandRuns the command as the player who clicks/tellraw @a {text:"Click",click_event:{action:"run_command",command:"/say hi"}}
suggest_commandcommandPuts the text into the chat box/tellraw @a {text:"Click",click_event:{action:"suggest_command",command:"/tp @s 0 64 0"}}
open_urlurlOpens a web address/tellraw @a {text:"Click",click_event:{action:"open_url",url:"https://www.minecraft.net"}}
copy_to_clipboardvalueCopies the text to the clipboard/tellraw @a {text:"Click",click_event:{action:"copy_to_clipboard",value:"copied text"}}
change_pagepageTurns to a page in a book, 1 or higher/tellraw @a {text:"Click",click_event:{action:"change_page",page:2}}
show_dialogdialogOpens a dialog, by id or written out/tellraw @a {text:"Click",click_event:{action:"show_dialog",dialog:"minecraft:server_links"}}
customid, payload (optional)Sends a custom event to the server/tellraw @a {text:"Click",click_event:{action:"custom",id:"my_pack:event",payload:{a:1}}}

Hover actions

show_textvalueA text component as tooltip/tellraw @a {text:"Hover",hover_event:{action:"show_text",value:{text:"Tooltip",color:"yellow"}}}
show_itemid, count (optional), components (optional)The tooltip of an item/tellraw @a {text:"Hover",hover_event:{action:"show_item",id:"minecraft:diamond_sword",count:1,components:{"minecraft:damage":5}}}
show_entityid, uuid, name (optional)Type, name and UUID of an entity/tellraw @a {text:"Hover",hover_event:{action:"show_entity",id:"minecraft:pig",uuid:"dd12be42-52a9-4a91-a8a1-11c01849e498",name:"Porky"}}

Where text components are used

Chat message/tellraw @a "Hello"
Title/title @a title {text:"Welcome",color:"gold",bold:true}
Action bar/title @a actionbar {text:"Low health",color:"red"}
Sign text/setblock ~ ~ ~ minecraft:oak_sign{front_text:{messages:["Line 1",{text:"Line 2",color:"red"},"",""]}}
Entity name/summon minecraft:zombie ~ ~ ~ {CustomName:{text:"Boss",color:"dark_red"},CustomNameVisible:1b}
Item name/give @s minecraft:stick[custom_name={text:"Magic Wand",color:"gold",italic:false}]
Boss bar name/bossbar add my_pack:boss {text:"Boss",color:"red"}
Objective name/scoreboard objectives add kills minecraft.killed:minecraft.zombie {text:"Zombie Kills",color:"green"}

Examples

/tellraw @a {text:"Hello",color:"red"}

Sends a red Hello to every player.

/tellraw @a ["",{text:"A",color:"red"},{text:"B",color:"blue"}]

Sends a red A followed by a blue B. The empty first entry keeps the colors apart.

/tellraw @a {text:"Click",click_event:{action:"suggest_command",command:"/tp @s 0 64 0"}}

Sends text that fills the chat box with a teleport command when clicked.

/tellraw @a ["Score: ",{score:{name:"@s",objective:"kills"},color:"gold"}]

Shows the kills score of whoever runs the command.

/tellraw @a {text:"Hover",hover_event:{action:"show_item",id:"minecraft:diamond_sword",count:1,components:{"minecraft:damage":5}}}

Sends text that shows a diamond sword tooltip when the pointer rests on it.

/title @a title {text:"Welcome",color:"gold",bold:true}

Shows a bold gold title to every player.

/title @a subtitle {text:"Good luck",italic:true}

Sets the subtitle shown under the next title.

/title @a actionbar {text:"Low health",color:"red"}

Shows red text above the hotbar.

/title @a times 0.5s 3s 1s

Sets titles to fade in for half a second, stay 3 seconds and fade out for 1 second.

Join the creator communityThe people who build the Minecraft Java Edition wiki are on our Discord. Ask questions or suggest pages.Join Discord (opens Discord in a new tab)