title | description | comments |
---|---|---|
Rich Text Markup |
Rich Text Markup are simple markup tags to style sections of a string. |
1. Replace numbered footnotes with dedicated style.
|
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 Class.TextLabel
, Class.TextButton
, and Class.TextBox
objects.
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 Class.LocalScript
.
local title = Instance.new("TextLabel")
title.RichText = true
title.Text = "Use a <b>bold title</b>"
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>
<font color=""> </font>
`I want the orange candy.`
`I want the orange candy.`
<font size=""> </font>
`This is big. This is small.`
<font face=""> </font>
`This is Michroma face.`Font face/family names are listed on the `Datatype.Font` enum reference page.
<font family=""> </font>
`This is Michroma face.`Font face/family names are listed on the `Datatype.Font` enum reference page.
<font weight=""> </font>
`This is normal. This is heavy.`Font weight can be a case-insensitive string name including `Thin`, `ExtraLight`, `Light`, `Regular`, `Medium`, `SemiBold`, `Bold`, `ExtraBold`, or `Heavy`; it can also be a number in factors of 100 between `100` and `900`.
`This is normal. This is heavy.`
<stroke> </stroke>
`You won 25 gems.`See [UIStroke](../ui/layout-and-appearance.md#uistroke) for details on `` tag parameters such as `joins` and `thickness`.
<font transparency=""> </font>
`Text at 50% transparency.`
<b> </b>
`Text in bold.`
<i> </i>
`Text italicized.`
<u> </u>
`Text underlined.`
<s> </s>
`Text withstrikethroughapplied.`
<br />
`New line occurs after this sentence.
Next sentence...`
<uppercase> </uppercase>
<uc> </uc>
`Uppercase makes words read loudly!`
`Uppercase makes words read loudly!`
<smallcaps> </smallcaps>
<sc> </sc>
`My name is Diva Dragonslayer.`
`My name is Diva Dragonslayer.`
<!-- -->
`After this is a comment... and now more text...`
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 < by escaping an ampersand` | Render another escape form **<** by escaping an ampersand |