2.2 Notations

  • Some common HTML tags can be used directly without tags$, such as p, h1, div, span, etc.

  • Less common HTML tags require using tags$, such as tags$nav.

  • Get rid of tags$ using withTags():

    withTags(
      nav(
        div(),
        ul(
          li(),
          li()
        )
      )
    )
    <nav>
      <div></div>
      <ul>
        <li></li>
        <li></li>
      </ul>
    </nav>
  • Use tagList() to gather multiple HTML elements together, instead of list(), because a special class is added (shiny.tag.list), which allows for extra capabilities, such as printing as HTML content:

    tagList(
      p("Paragraph"),
      p("Sibling of the previous paragraph")
    )
    <p>Paragraph</p>
    <p>Sibling of the previous paragraph</p>