r - How to display widgets inline in shiny -
i have below code display widgets inline(in same row) in shiny
div(style="display:inline-block; width: 150px;height: 75px;",selectinput("ddllgra", "function:",c('mean','median','sd','count','min','max'), selected='mean')), div(style="display:inline-block; width: 150px;height: 75px;",textinput(inputid="xlimitsmax", label="x-max", value = 0.5))
it coming out in ui, not in same line order. 1 in coming in upper side , other coming on lower side 1 same line.
is there way correct misalignment?
add vertical-align:top
style
rm(list = ls()) library(shiny) ui <- fluidpage( sidebarpanel( div(style="display: inline-block;vertical-align:top; width: 150px;",selectinput("ddllgra", "function:",c('mean','median','sd','count','min','max'), selected='mean')), div(style="display: inline-block;vertical-align:top; width: 150px;",textinput(inputid="xlimitsmax", label="x-max", value = 0.5))), mainpanel() ) server <- shinyserver(function(input,output){}) shinyapp(ui, server)
edit: how add space between divs
you can use same approach: example below has 100px
between divs
rm(list = ls()) library(shiny) ui <- fluidpage( sidebarpanel( div(style="display: inline-block;vertical-align:top; width: 150px;",selectinput("ddllgra", "function:",c('mean','median','sd','count','min','max'), selected='mean')), div(style="display: inline-block;vertical-align:top; width: 100px;",html("<br>")), div(style="display: inline-block;vertical-align:top; width: 150px;",textinput(inputid="xlimitsmax", label="x-max", value = 0.5))), mainpanel() ) server <- shinyserver(function(input,output){}) shinyapp(ui, server)
Comments
Post a Comment