ui.R

Let's start with the things to add to the ui.R. Once again, we add a place for the text to live to the graph tab:

tabPanel("Trend", plotOutput("trend"),         h3("User selection history"),         p(id = "selection", ""))

Then, we add a button to add the text and some controls to the sidebar:

actionButton("buttonClick", "Add inputs"),   selectInput("color", "Text colour",               c("Red" = "red",                 "Blue" = "blue",                 "Black" = "black")),   selectInput("size", "Text size",              c("Extremely small" = "xx-small",                 "Very small" = "x-small",                "Small" = "small",                 "Medium" = "medium",                 "Large" = "large",                 "Extra large" = "x-large",                 "Super size" = "xx-large"))

The last addition is a reference to the JavaScript file that will make everything happen. We add this with the ...

Get Web Application Development with R Using Shiny - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.