Skip to content

Rich Text

Rich text renders a string of HTML, e.g. content from a CMS or a rich text editor. Use it for formatted paragraphs, lists and headlines which you do not want to compose from Text views. Only render HTML from trusted sources. To render Markdown, convert it with markdown.RichText(value string) ui.TRichText from package presentation/ui/markdown.

Rich Text

RichText(`<h2>Release notes</h2>
<p>This release brings <b>faster rendering</b> and <i>many</i> small fixes.</p>
<ul>
  <li>New slider component</li>
  <li>Improved dialogs</li>
</ul>`).Frame(Frame{Width: L480})

A relative link of the own origin navigates within the application, like a link of a stack, instead of loading the page anew. An external link opens in a new tab, which gets no access to the application. For text which neither you nor the user wrote, e.g. the answer of an AI model, ConfirmExternalLinks(true) asks the user before an external link is opened and shows its full address.

Constructors

ConstructorDescription
func RichText(value string) TRichTextCreates a rich text component with the given HTML.

Methods

MethodDescription
ConfirmExternalLinks(confirm bool) TRichTextConfirmExternalLinks asks the user before an external link is opened and shows its full address.
Frame(frame Frame) TRichTextFrame sets the layout frame for the rich text component.
FullWidth() TRichTextFullWidth expands the rich text component to take the full available width.
Value(value string) TRichTextValue sets the rich text content to be rendered.

Related