I am trying to display text in Shiny(server.R). But I also need to add a button next to the displayed text.
When when I open the application I can see the plain HTML content (but no button)
Shiny code sample below
library(shiny)
ui <- fluidPage(
headerPanel("Example reactiveValues"),
mainPanel(
# input field
textInput("user_text", label = "Enter some text:", placeholder = "Please enter some text."),
actionButton("submit", label = "Submit"),
# display text output
textOutput("text"))
)
server <- function(input, output) {
flag_1 <- TRUE
text_reactive = reactiveValues(text = "No values are updated")
output$text <- renderText({
text_reactive$text
})
observeEvent(input$submit,{
if(flag_1 <- FALSE)
{
text_reactive$text <- input$user_text
}
else {
text_reactive$text <- paste0("hi", HTML(as.character(actionButton('id','label'))))
}
})
So, when you write something and click on submit, there should be "Hi" and a button
Is there a way to render the HTML code into an actual button?