2014-12-02 2 views
4

머리글 외에 반짝이 위젯 (예 : 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 }) 

답변

5

이 당신이 원하는 무엇인가?

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

+0

맞아, 감사합니다! ID로 요소를 어떻게 참조 할 수 있습니까? 대신'# options'을 사용하면 이상하게도 2 개의 드롭 다운 상자가 생깁니다. – geotheory

+0

좀 더 일반적으로'.selectize-control.single'에 어떻게 접근 했습니까? 나는 이것에 대한 언급을 찾을 수 없다. 다시 한 번 감사드립니다 – geotheory

+1

'id = 'option'' 엘리먼트는 보이지 않기 때문에 우리는 그것을 타겟으로하지 않습니다. 선택 컨트롤의 두 가지 가시적 인 구성 요소는 레이블과 선택기 자체입니다. '.selectize-control.single'는'class = "selectize-control single"과 동일합니다. 그래서이 두 클래스를 가진 요소를 대상으로합니다. – jdharrison

관련 문제