-
-
Save quevedin/6c5b8e03484f71a76f2f to your computer and use it in GitHub Desktop.
Adding raw HTML to Shiny apps
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Nothing to see here | |
shinyServer(function(input, output) { | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div>Here is a <strong>third</strong> way.</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
shinyUI(bootstrapPage( | |
div( | |
div( | |
# You can use a string value as HTML by wrapping it with the HTML | |
# function. If you didn't do that, then the string would be treated as | |
# plain text and the HTML tags would be escaped. See ?HTML. | |
HTML("Here is <strong>one</strong> way to insert <em>arbitrary</em> HTML.") | |
), | |
div( | |
# Another way is to use the builder functions; see ?tags. | |
"Here is", | |
tags$span( # Creates an HTML span. | |
class="foo", # Any named args become attributes. | |
tags$strong("another"), # Unnamed args become children of the tag. | |
"way" | |
), | |
"to do it." | |
), | |
# The third way is to include a separate HTML file. | |
includeHTML("static.html") | |
) | |
)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment