Minecraft wiki entry for tellraw, associated text: To send the message "text to display" in chat:
/tellraw @a "text to display"‌[Java Edition only]
/tellraw @a {"rawtext":[{"text":"text to display"}]}‌[Bedrock Edition only]
To send the message "I am blue" colored blue in chat:
/tellraw @a {"text":"I am blue","color":"blue"}‌[Java Edition only]
/tellraw @a {"rawtext":[{"text":"§9I am blue"}]}‌[Bedrock Edition only]
If you want to use a hex code:
/tellraw @a {"text":"I am blue","color":"#5555ff"}‌[Java Edition only]
To send the message "Hover me!" in chat, which displays the text "Hi!" when hovered over:
/tellraw @a {"text":"Hover me!","hoverEvent":{"action":"show_text","value":"Hi!"}}‌[Java Edition only]
Use '\n' to insert a new line:
/tellraw @a "Text1\nText2"‌[Java Edition only]
/tellraw @a {"rawtext":[{"text":"Text1\nText2"}]}‌[Bedrock Edition only]
Using scoreboard values in tellraw:
/tellraw @a [{"text":"Value for player Player1 for objective Test: ","color":"yellow"},{"score":{"name":"Player1","objective":"Test"}}]‌[Java Edition only]
/tellraw @a {"text":"Hover me for Player1 score for objective Test...","color":"green",hoverEvent:{"action":"show_text","value":{"score":{"name":"Player1","objective":"Test"}}}}‌[Java Edition only]
Using values in translations
/tellraw @a {"rawtext":[{"translate":"chat.type.announcement","with":["value1","value2"]}]} Localization: chat.type.announcement=[%s] %s‌[Bedrock Edition only]