Set distance between widgets is a shiny app


#1

I have the simple shiny app below

#ui.r
navbarPage(
  "Application",
  tabPanel("General",
           sidebarLayout(
             
             sidebarPanel(
               uiOutput("num8"),
               uiOutput("num9")
             ),
             
             mainPanel(
               
               
               
             )
           )
           
  )
)
#server.r
library(shiny)

server <- function(input, output,session) {
  
  output$c1<-renderUI({
    checkboxInput("ch1", 
                  h5("Person ID"), value = FALSE)
  })
  
  output$num8<-renderUI({
    
      textInput("nm8", 
                h6("Column"), 
                value = 1)
    
    
  })
  output$num9<-renderUI({
    
    textInput("nm9", 
              h6("Column"), 
              value = 1)
    
    
  })
  
  
  
  
}

I want to bring those 2 widgets closer to one another as they still are one below the other.


#2

You want to have them side-by-side on one row or just less space between the bottom of one and the top of the other?


#3

The second. I want less space between the bottom of one the top of the other.


#4

you'd need to edit the css for that type of element. in your ui, try something like:

tags$head(
    tags$style(
      HTML(
        "
          .form-group {
            margin-bottom: 0 !important;
          }
        "
        )
      )
  ),

#5

Where exactly in my ui should I put it? After sidebarPanel( maybe?


#6

sorry I didn't notice you'd replied! Put it at the start of the navbarPage()