将闪亮的小部件放在标题旁边

时间:2014-12-02 12:09:48

标签: r shiny

如何定位Shiny小部件(例如selectInput()的下拉框)除了标题之外?我一直在玩各种tags配方而没有任何运气。感谢任何指针。

ui.R

library(shiny)  
pageWithSidebar( 
  headerPanel("side-by-side"), 
  sidebarPanel(
tags$head(
  tags$style(type="text/css", ".control-label {display: inline-block;}"),
  tags$style(type="text/css", "#options { display: inline-block; }"),
  tags$style(type="text/css", "select { display: inline-block; }")
),
selectInput(inputId = "options", label = "dropdown dox:", 
  choices = list(a = 0, b = 1))
  ),
  mainPanel( 
    h3("bla bla")
  )
)

server.R

shinyServer(function(input, output) { NULL })

1 个答案:

答案 0 :(得分:6)

这是你想要的吗?

library(shiny)  

runApp(list(ui = pageWithSidebar( 
  headerPanel("side-by-side"), 
  sidebarPanel(
    tags$head(
      tags$style(type="text/css", "label.control-label, .selectize-control.single{ display: inline-block!important; }")
    ),
    selectInput(inputId = "options", label = "dropdown dox:", 
                choices = list(a = 0, b = 1))
  ),
  mainPanel( 
    h3("bla bla")
  )
)
, server = function(input, output) { NULL })
)

enter image description here