Skip to content

TextComponents in config

TheChilliPL edited this page Jul 20, 2020 · 1 revision

TextComponent is a basic text element.

The simplest way to write it in config is just a string:

component: Hello!

It's a simple text without formatting. You can also use color-codes like &4 in it:

no_permission: "&4You have no permission to use this command!"

The most expandable format is an object, structured like below:

text: "Text of the component\n"
extra:
- "Extra components, appearing after the parent.\n"
- text: They inherit parent's formatting unless changed.
  color: dark red
# Supported colors:
# black, dark blue, dark green, dark aqua,
# dark red, dark purple, gold, gray,
# dark gray, blue, green, aqua,
# red, light purple, yellow,
# white, reset (cancels color inheriting).
color: red
# Properties below are booleans.
# By default, they're false, unless their parent has them on—then, false can be used to cancel parent's formatting.
bold: true
italic: true
underlined: false
strikethrough: false
obfuscated: true
insertion: This text appears in the chat input box when shift-clicked.
clickEvent:
  # Can be:
  # open url, open file, run command, suggest command, change page, copy to clipboard.
  action: open url
  # action            | value
  # open url          | URL to open
  # open file         | path of the file to be opened
  # run command       | command to run (in most cases including slash)
  # suggest command   | text to put into chat input when clicked
  # copy to clipboard | text to copy to the clipboard
  value: https://github.com/TheChilliPL/textcomponentserialization
hoverEvent:
  # Currently, only show text is supported.
  action: show text
  value:
    text: Text component shown in a tooltip when hovered.
    italic: true

All properties are optional, except action and value if events are there.

Clone this wiki locally