Chinmay Patil Chinmay Patil - 11 months ago 73
R Question

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


Create an input control for entry of unstructured text values


textInput(inputId, label, value = "")

Input variable to assign the control's value to

Display label for the control

Initial value


A text input control that can be added to a UI definition.


textInput("caption", "Caption:", "Data Summary")

Answer Source

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.