Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create TextArea as input in a Shiny webapp in R?

I am trying to create simple webapp where I want to take in multiline input from user using HTML textarea control. Is there any out of the box way of creating such an input control in Shiny?

Help page of textInput doesn't show much options

textInput {shiny}   R Documentation Create a text input control  Description  Create an input control for entry of unstructured text values  Usage    textInput(inputId, label, value = "") Arguments  inputId  Input variable to assign the control's value to  label    Display label for the control  value    Initial value  Value  A text input control that can be added to a UI definition.  Examples  textInput("caption", "Caption:", "Data Summary") 
like image 396
CHP Avatar asked Jan 22 '13 05:01

CHP


1 Answers

You can add a textarea using tags and it should be picked up by Shiny automatically:

tags$textarea(id="foo", rows=3, cols=40, "Default value") 

Or if you're more comfortable with straight HTML you can also do

HTML('<textarea id="foo" rows="3" cols="40">Default value</textarea>') 

In either case, input$foo should reflect the textarea's value.

like image 180
Joe Cheng Avatar answered Oct 04 '22 11:10

Joe Cheng