1

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?

Williams86
  • 320
  • 1
  • 11

1 Answers1

1

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.

ismirsehregal
  • 30,045
  • 5
  • 31
  • 78