You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It could be fine if we can add easily a class attribute for custom style with CSS. A class attribute can be added for the input element and the span child element
library(shiny)
library(htmltools)
ui <- fluidPage(
uiOutput("dynamicCheckbox") # This will display the checkboxGroupInput
)
server <- function(input, output, session) {
output$dynamicCheckbox <- renderUI({
# Create the checkboxGroupInput
checkbox_group <- checkboxGroupInput(
inputId = "myCheckboxGroup",
label = "Choose options:",
choices = c("Option 1" = "opt1", "Option 2" = "opt2", "Option 3" = "opt3")
)
# Use tagQuery to modify the checkboxGroupInput
modified_checkbox_group <- tagQuery(checkbox_group)$find("input")$addClass("my-custom-class")$allTags() # Convert back to tags
# Return the modified checkboxGroupInput for rendering
modified_checkbox_group
})
}
shinyApp(ui, server)
Other possible syntax :
# Use tagQuery to modify the checkboxGroupInput
modified_checkbox_group <- tagQuery(checkbox_group)$
find("input")$ # find the element input
addClass("my-custom-class")$ # Convert add class to input element
allTags() # Convert back to tags
# Return the modified checkboxGroupInput for rendering
modified_checkbox_group
Hi,
It could be fine if we can add easily a class attribute for custom style with CSS. A class attribute can be added for the input element and the span child element
With the class it could be easy to style the element with CSS directly with the class name and not by creating a selector like:
Thank :)
The text was updated successfully, but these errors were encountered: