Home > Enterprise >  Interchange the position of label and check-box in checkboxInput() shiny
Interchange the position of label and check-box in checkboxInput() shiny

Time:01-08

In checkboxInput(), the ckeck-box appears before the text given in label argument, by default. I was trying to shift the check-box to the left and the label to right. Is there any CSS argument to interchange the positions also to specify a specific gap between the label and check-box?

CodePudding user response:

This is mainly taken from here:

library(shiny)

ui <- fluidPage(
  tags$style("
             .cbcontainer {
               display: inline-block;
             }
             
             .checkbox {
               text-align: right;
               display: inline-block;
             }
             
             .checkbox input {
               float: right;
               position: relative !important;
               margin: 5px !important;
             }
             
             .checkbox label {
               padding-left: 0px !important;
             }
             "),
  div(checkboxInput("My checkbox", label = "mycheckbox"), class = "cbcontainer")
)

server <- function(input, output, session) {}

shinyApp(ui, server)

To better understand the css part also see this.

  •  Tags:  
  • Related