2017-07-18 3 views
0

私はselectInputウィジェットをShinyに持っています。ShinyのselectInputのラベルと選択肢のテキストのフォントサイズスタイルを個別に制御する方法は?

は別途label引数の両方のために、ウィジェット自体(choicesselectedの引数、すなわち、テキスト)の入力テキストのフォントサイズを制御したい

初期[スタイルレス]出力は次のようになります。

selectInput(inputId = "inId", label = "Different Font Size...", choices = "...From This") 

enter image description here

私はそうのようなdiv()を使用してみました:

labelテキストとの両方を縮小
div(style = "font-size: 8px", 
    selectInput(inputId = "inId", label = "Different Font Size...", choices = "...From This") 

) 

入力テキスト(すなわち、choicesのテキスト)。

enter image description here

  • 注:これは、その代わりにのみ影響labelテキスト(としない入力テキスト)、textInputこのdiv(style = ...)アプローチを使用してとは対照的です。この場合

    • 、Iは次いで使用tags$style("#inId {font-size:8px;}")別々に入力フォントサイズを変更するtextInput機能を以下であろう。

      div(style = "font-size: 8px", 
          textInput(inputId = "inId", label = "Different Font Size...", value = "...From This") 
      ), tags$style("#inId {font-size:14px;}") 
      

しかし、これはselectInput()を使用してない作業を行います。

  • 結果のテキストスタイルに何もしていないようだdiv(style = ...)ラッパーを次tag$style(...)の指定。

    div(style = "font-size: 8px", 
         selectInput(inputId = "inId", label = "Different Font Size...", choices = "...From This") 
    ), tags$style("#inId {font-size:14px;}") 
    ) 
    

だから私はこれをどのように行うのですか?

私はテキストスタイル(特にフォントサイズ)を制御するにはどうすればよい別途シャイニーを使用してselectInputウィジェットのlabelchoicesテキストの?

  • 繰り返しますが、私の目標は、次の操作を実行する能力を達成することである。

    enter image description here


重要場合:私はshiny_1.0.3を使用していますRバージョン3.4.0

答えて

1

p selectInput()ラベル自体はの両方で、別のフォントサイズのdiv()にあります。ラベルのスタイルは外側のdivのスタイルを上書きします。

shinyApp(
    ui = fluidPage(
    div(style = "font-size:20px;", 
     selectInput(inputId = "inId", label = div(style = "font-size:80px", "Different Font Size..."), 
        choices = c("...From This", "Test") 
       ) 
    ) 
), 
    server = function(input, output) { 

    } 
) 

これが役立つことを願っています。
歓待

関連する問題