I have this Shiny App where a user would write text into a textInput
field and whenever the text is in my dataframe the text will be displayed in a tableOutput
. The textInput from the user should be then highlighted in a certain color lets say red in the output table.
How would i do this?
library(shiny)
df = tibble(Text=c("The quick brown fox", "jumps over", "the lazy dog"))
ui =fluidPage(
fluidRow(
textInput("input", "Textinput"),
tableOutput("output")
)
)
server = function(input, output){
df_reactive = reactive({
df %>%
filter(str_detect(text, input$input))
})
output$output = renderTable({
df_reactive()["text"]
})
}
shinyApp(ui = ui, server = server)
for clarification: if a user types 'dog', only the rows in which 'dog' occurs should be displayed in the table output and only dog should be coloured red