Open nteetor opened 5 years ago
You can use the render
option of selectize
:
render <- "
{
option: function(data, escape){return '<div class=\"option\">'+data.label+'</div>';},
item: function(data, escape){return '<div class=\"item\">'+data.label+'</div>';}
}"
ui <- fluidPage(
selectizeInput(
"age", "Age category",
choices = c(
"≤ 6 months" = 1,
"6 months - 17 years" = 2,
"≥ 18 years" = 3
),
options = list(
render = I(render)
)
)
)
server <- function(input, output){}
shinyApp(ui, server)
I was hoping to include some non-breaking spaces in a select input choice. But, I discovered even when using
HTML()
the choice names are always escaped. This happens inshiny:::selectOptions()
. Is there any chanceselectOptions()
could be updated to check for values marked withHTML()
and not escape those values? Is so, I can put together a PR.