Skip to content

Instantly share code, notes, and snippets.

@pvictor
Last active April 13, 2021 00:31
Show Gist options
  • Save pvictor/aae0413ca56c5947f0d816e5aff2cfeb to your computer and use it in GitHub Desktop.
Save pvictor/aae0413ca56c5947f0d816e5aff2cfeb to your computer and use it in GitHub Desktop.
Inline shinyWidgets::pickerInput
library(shiny)
library(shinyWidgets)
library(htmltools)
ui <- fluidPage(
tags$h2("Inline pickers input"),
tags$br(),
# CSS styles
tags$style(
".btn-inline {
background: #FFF;
border-bottom: solid 1px steelblue;
border-radius: 0;
}",
".btn-inline .filter-option-inner-inner { font-size: large; }"
),
# Inline pickers
tags$div(
style = "text-align: center;font-size: large;",
tags$span("Filter by"),
tagAppendAttributes(
pickerInput(
inputId = "optionA",
label = NULL,
width = "fit",
choices = paste("choice A -", 1:10),
options = pickerOptions(
style = "btn-inline"
)
),
class = "shiny-input-container-inline",
style = "display: inline-block;"
),
tags$span(
"and by"
),
tagAppendAttributes(
pickerInput(
inputId = "optionB",
label = NULL,
width = "fit",
choices = paste("choice B -", 1:10),
options = pickerOptions(
style = "btn-inline"
)
),
class = "shiny-input-container-inline",
style = "display: inline-block;"
)
)
)
server <- function(input, output, session) {
}
shinyApp(ui, server)
@pvictor
Copy link
Author

pvictor commented Nov 12, 2020

Which renders:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment