UI rich text utilizes simple markup tags to style sections of a string in bold, italics, underline, fill color, stroke variations, and more. You can apply styling tags to TextLabel, TextButton, and TextBox objects.
Enabling Rich Text
You must enable rich text on a per-object basis through its RichText property in the Properties window, or by setting the property to true in a LocalScript.
local title = Instance.new("TextLabel")title.RichText = truetitle.Text = "Use a <b>bold title</b>"
Supported Tags
Rich text tags are similar to XML/HTML tags and you must include both an opening and closing tag around the formatted text.
<b>Formatted Text</b>
You can also nest tags inside each other as long as you close them in the reverse order of how you opened them.
<b><i><u>Formatted Text</u></i></b>
Color
<font color=""> </font>
I want the <font color="#FF7800">orange</font> candy.
I want the <font color="rgb(255,125,0)">orange</font> candy.
Size
<font size=""> </font>
<font size="40">This is big.</font> <font size="20">This is small.</font>
Font Face
<font face=""> </font>
<font face="Michroma">This is Michroma face.</font>
Font Family
<font family=""> </font>
<font family="rbxasset://fonts/families/Michroma.json">This is Michroma face.</font>
Font Weight
<font weight=""> </font>
This is normal. <font weight="heavy">This is heavy.</font>
This is normal. <font weight="900">This is heavy.</font>
Stroke
<stroke> </stroke>
You won <stroke color="#00A2FF" joins="miter" thickness="2" transparency="0.25">25 gems</stroke>.
Transparency
<font transparency=""> </font>
Text at <font transparency="0.5">50% transparency</font>.
Bold
<b> </b>
Text in <b>bold</b>.
Italic
<i> </i>
Text <i>italicized</i>.
Underline
<u> </u>
Text <u>underlined</u>.
Strikethrough
<s> </s>
Text with <s>strikethrough</s> applied.
Line Break
<br />
New line occurs after this sentence.<br />Next sentence...
Uppercase
<uppercase> </uppercase>
<uc> </uc>
<uppercase>Uppercase</uppercase> makes words read loudly!
<uc>Uppercase</uc> makes words read loudly!
Small Caps
<smallcaps> </smallcaps>
<sc> </sc>
My name is <smallcaps>Diva Dragonslayer</smallcaps>.
My name is <sc>Diva Dragonslayer</sc>.
Comment
<!-- -->
After this is a comment...<!--This does not appear in the final text--> and now more text...
Escape Forms
If you want to render certain characters like < or > and exempt them from consideration as part of rich text tags, you can write them in their escape form.
Character | Escape | Example | Result |
---|---|---|---|
< | < | 10 < 100 | 10 < 100 |
> | > | 100 > 10 | 100 > 10 |
" | " | Meet "Diva Dragonslayer" | Meet "Diva Dragonslayer" |
' | ' | Diva's pet is a falcon! | Diva's pet is a falcon! |
& | & | Render another escape form <b>&lt;</b> by escaping an ampersand | Render another escape form < by escaping an ampersand |