Chinmay Patil Chinmay Patil - 1 year ago 101
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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download