Reputation: 2164
Here's the basics of my problem:
ui.R
gets to insert the name of an artist using a regular text input. This is then saved in input$artist_name
.server.R
, some stats about the artist's top track are then displayed using some intermediate calls and computations. I then use renderPlot()
to put a plot in output$Plot
. server.R
(since here is where I learn what the most popular track is and, subsequently, its URL) to "push" the URL of the track back to ui.R
so that I can include the player in a panel using the HTML()
function. Is this possible? To me, it kind of seems as if what I want to do is similar to what you can do with uiOutput()
and renderUI()
, although obviously not for making a custom UI depending on the user's input but rather some custom HTML code depending on the input.Any help is greatly appreciated!
Upvotes: 1
Views: 852
Reputation: 5779
I am not sure exactly what you are asking, but it is not too hard to create arbitrary HTML in the server and send it to UI. Here is an example:
library(shiny)
ui =fluidPage(
textInput("test","Write here"),
uiOutput("example")
)
server=shinyServer(function(input, output, session) {
output$example <- renderUI({
HTML(paste0("<div style='color:red;'>",input$test,"</div>"))
})
})
shinyApp(ui=ui,server=server)
Upvotes: 2