[英]How to add bigger textInput box in R Shiny?
I am creating a Shiny App, where in one part I need the user to input a text summary, but the default size of text input box appearing in the App is very small. 我正在创建一个Shiny App,其中我需要用户输入文本摘要,但是该应用中出现的文本输入框的默认大小非常小。 difficult for users to enter a summary of 3-4 lines. 用户难以输入3-4行的摘要。 Could you help me with the script that can make the text input box bigger. 您能否通过脚本使文本输入框变大来帮助我。 really appreciate your help! 非常感谢您的帮助!
=========== I just tried the following with HTML tags: ============我尝试使用HTML标签进行以下操作:
library(shiny)
shinyUI(fluidPage(
sidebarLayout(
sidebarPanel(
tags$textarea(id="my_textarea", rows=5, "Leave a comment...")
),
mainPanel(
uiOutput("my_output")
)
)
))
but got some error - shown below! 但是出现了一些错误-如下所示!
Try using textAreaInput
instead of textInput
. 尝试使用textAreaInput
而不是textInput
。 With the former you can set height and width, and it automatically will wrap to next line if line is too long. 使用前者,您可以设置高度和宽度,如果行太长,它将自动换行到下一行。
This seems to be a duplicate of this question; 这似乎是这个问题的重复。 Multi line text inputs in shiny 多行文本输入闪亮
I made a small aesthetic change(css to 100%), but it does work as it is. 我做了一个小的美学更改(css达到100%),但它确实可以正常工作。 The error might be from some other section of your code. 该错误可能来自代码的其他部分。 See the example below. 请参见下面的示例。
library(shiny)
ui<-shinyUI(fluidPage(
sidebarLayout(
sidebarPanel(
tags$style(type="text/css", "textarea {width:100%}") ,
tags$textarea(id="my_textarea", rows=5,placeholder = "Leave a comment...", "")
)
,mainPanel( h4('My panel') )
)
))
server <- shinyServer(function(input, output) {})
shinyApp(ui, server)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.