Reputation: 13334
I have created three divs in my R Shiny App and need to add buttons inside those divs. If I try a usual HTML approach I would do something like this:
div("Here is some text inside the div", style = "color:green; font-size:20px; background-color: white; border: 1px solid #ccc; border-radius: 3px; margin: 10px 0; padding: 10px; width: 700px", <input type='submit' value='Dismiss'/>)
but this obviously fails because divs are done differently than regular html in R Shiny.
How can I get 2 buttons inside my div (like the image) in R Shiny App?
Thanks,
Upvotes: 2
Views: 7055
Reputation: 771
I've found that once you want to exercise a bit more control over the layout, styling, and interactions in a Shiny app its best to switch the ui.R output over to html/css/js that you control.
http://rstudio.github.io/shiny/tutorial/#html-ui
Upvotes: 0
Reputation: 17517
You can use the HTML()
function to render regular HTML. Or you can use the shiny::tags
variable to create any valid HTML tag a la
div("Somee text", style="someStyle",
tags$input(type="submit", value="Dismiss")
)
I find that Shiny-ifying all the UI code ends up being cleaner than mixing and matching HTML and Shiny functions.
Upvotes: 4