How To Dynamically Style A Pickerinput Menu In Shiny
I would like to update the colours of my pickerInput based on input from the colourInput in the below example. This questions follows on from this question and replicating this wit
Solution 1:
CSS <- function(colors){
template <- "
.dropdown-menu ul li:nth-child(%s) a {
background: %s !important;
color: white !important;
}"
paste0(
apply(cbind(seq_along(colors), colors), 1, function(vc){
sprintf(template, vc[1], vc[2])
}),
collapse = "\n"
)
}
and
output$css <- renderUI({
tags$style(HTML(CSS(cols_user())))
})
To deal with CSS, you should try the inspector tool (right-click on an element, then "Inspect").
Baca Juga
- Need To Display Dynamic Text Generated From Server Onto Ui Within A Textarea(with Syntax Highlighting)
- R Shiny: How To Embed Sliderinputs/selectinputs And Radiobuttons In A Data Frame ? (error: Cannot Coerce Class ""shiny.tag"" To A Data.frame)
- Display Of Text In A New Line Below The Uioutput Display [shiny]
Post a Comment for "How To Dynamically Style A Pickerinput Menu In Shiny"