Ajay jadhav
Ajay jadhav

Reputation: 153

I want Shiny UI with multiple inputs in a row

I want shiny sliderInput to be biuld like attached imageenter image description here

side by side values i want like min and max. the input should be manual and not by slider or dropdown

I tried selectInput but its taking one value in a row I want two values in one row

Upvotes: 2

Views: 5850

Answers (2)

Tonio Liebrand
Tonio Liebrand

Reputation: 17689

You could use fluidRow() and column(). You start by using a fluidRow() and add columns() within that functions,...

Reproducible example:

library(shiny)
ui <- fluidPage(
  fluidRow(
    column(width = 3,
           selectInput("min", "Min Price", 1:4)
    ),
    column(width = 3, 
           selectInput("max", "Max Price", 1:4)
    )
  ),
  fluidRow(
    column(width = 3,
           selectInput("min2", "Property type", letters[1:4])
    ),
    column(width = 3, 
           selectInput("max2", "Bedrooms", 1:4)
    )
  )
)

shinyApp(ui, server = function(input, output){ })

Upvotes: 8

rfortin
rfortin

Reputation: 184

@BigDataScientist has a great answer. You can also look into splitLayout in your UI. First you call splitLayout, define the desired cellWidths, then call the objects.

splitLayout(cellWidths = c("50%", "50%"), selectInput(...), selectInput(...))

Upvotes: 4

Related Questions