Skip to contents

For certain pieces of text (like in column labels or table headings) we may want to express them as raw HTML. In fact, with HTML, anything goes so it can be much more than just text. The html() function will guard the input HTML against escaping, so, your HTML tags will come through as HTML when rendered... to HTML.


html(text, ...)


text, ...

The text that is understood to be HTML text, which is to be preserved.


A character object of class html. It's tagged as an HTML fragment that is not to be sanitized.


Use exibble to create a gt table. When adding a title, use the html() helper to use HTML formatting.

exibble %>%
  dplyr::select(currency, char) %>%
  gt() %>%
  tab_header(title = html("<em>HTML</em>"))

This image of a table was generated from the first code example in the `html()` help file.

Function ID