PcoWSkbVqDnWTu_dm2ix

Using Rich Text

Using Rich Text

5 min

Applying rich text to an individual text object string is done via simple markup tags. Currently, you can specify the font size, color, bold, italics, underline, and strikethrough, with more options upcoming.

Enabling Rich Text

Rich text must be enabled on a per-object basis through its RichText property.

  1. Select the TextLabel, TextButton, or TextBox object you wish to enter rich text into.
  2. Enable its RichText property in the Properties window or set it to true through scripting.
  1. Enter rich text markup inside its Text property according to the supported tags outlined below.

Tag Formatting

Tags are similar to XML/HTML tags and require both an opening and closing tag around the formatted text.

Tags can be nested inside each other as long as they are closed in the reverse order of how they’re opened.

Supported Tags

Formatting Tag Examples
Color <font color=""> I want the <font color="#FFA500">orange</font> candy.
I want the <font color="rgb(255,165,0)">orange</font> candy.
Size <font size=""> This is <font size="50">big</font> and this is <font size="10">small</font>.
Font Face* <font face=""> <font face="Michroma">This appears in Michroma font.</font>
Bold <b> This is a <b>bold</b> word.
Italic <i> This is an <i>italicized</i> word.
Underline <u> This word is <u>underlined</u>.
Strikethrough <s> This applies <s>strikethrough</s> to text.
Comment <!-- --> OK! <!--this comment does not appear in the final text-->

* Font face names can be found in the Name column of the Enum/Font reference page.

Escape Characters

Some characters have “escape” forms when rich text is enabled. If you want to display these characters without rich text parsing them, use their escape forms.

Character Escape Form Example Result
< &lt; 10 &lt; 100 10 < 100
> &gt; 100 &gt; 10 100 > 10
" &quot; Meet &quot;Diva Dragonslayer&quot; Meet "Diva Dragonslayer"
' &apos; Diva&apos;s pet is a falcon! Diva's pet is a falcon!
& &amp; Render another escape form <b>&amp;lt;</b> by escaping an ampersand. Render another escape form &lt; by escaping an ampersand.

Final Notes

TextBox Behavior

When a user-editable TextBox has TextBox/RichText|RichText enabled and the text box gains focus, the user will be able to edit and interact with the complete XML string, including all of the formatting tags. When focus is lost, the text will automatically parse and render the tags as rich text.

Localization

Currently, when you articles/Introduction to Localization on Roblox|localize a game to support other languages, formatting tags will be removed. To make formatting appear in other languages, you’ll need to re-apply the tags manually to your localized strings.

Tags:
  • rich text
  • text
  • bold
  • italic
  • style