问题 多行文字输入有光泽


我有什么选择来实现带有多行/换行符的文本输入(显式的或只是用于UI中更好的输出的软包装)?

我想实现一个具有描述/详细信息字段的应用程序,输入的内容很可能不仅仅是一行。

基本上,我正在寻找一些东西来实现stackoverflow的文本输入框的类似功能我正在写这个问题:换行符,滚动条和/或(自动)调整高度。

# UI ---------------------------------------------------------------------

ui <- fluidPage(
  p(),
  textInput("title", "Title"),
  textInput("description", "Description"),
  tags$hr(),
  h3("Database state"),
  DT::dataTableOutput("datatable")
)

# Server ------------------------------------------------------------------

server <- function(input, output, session) {
  output$datatable <- DT::renderDataTable(
    data.frame(
      Title = input$title,
      Description = input$description,
      stringsAsFactors = FALSE
    )
  )
}

shinyApp(ui, server)

10272
2017-12-17 09:04


起源

你想要的东西吗? stackoverflow.com/questions/14452465/... ? - Vongo
@Vongo:看起来很有前途,感谢指针!实际上,“Mutliline输入”确实描述了我所追求的比“断线”更好的东西 - Rappster


答案:


尝试使用 textAreaInput 代替 textInput。 使用前者可以设置高度和宽度,如果行太长,它会自动换行到下一行。

这里 是文档中提到的地方。


9
2017-12-23 04:29



注意 textAreaInput 需要闪亮的v0.14或更高版本 - User247365