Adjust the height of a textInput box as a user keeps typing

时间:2016-08-31 12:08:51

标签: css r shiny

I try to adjust the height of the box of a textInput. However, I am not familiar with CSS. I found some similar problems in which they recommend to use the following CSS snippet:

max-height: 200px;

I would very much appreciate if someone could help me to implement this into Shiny assuming the following is the text input I try to alter.

textInput("remarks", label = h3("Text input"), value = "")

3 个答案:

答案 0 :(得分:2)

textarea可能正是您所寻找的:

   ui = fluidPage( h4('This is a text area:') 
                  ,tags$textarea(id = 'remarks', placeholder = 'Type here', rows = 3, value="" ) 
        ) 
  server = function(input, output) { } 
  shinyApp(ui, server)

答案 1 :(得分:1)

如果你想要myltiple线路输入,请参阅@Ron Talbot回答

但是如果你真的想要200 px高度的输入,你可以这样做

library(shiny)

ui=shinyUI(fluidPage(
tags$head(tags$style("
                  #remarks  {  
   height: 200px;
                     }")),
textInput("remarks", label = h3("Text input"), value = "")
)

)

server=function(input,output){

}

shinyApp(ui,server)

答案 2 :(得分:0)

    <style>
        .text { height: 10px; }
    </style>