Insites Docs Web Components V2Data EntryTextarea

Textarea

Published on February 17, 2021, updated on June 01, 2021

Element: <ins-textarea>

Defines a textarea field.

Complete Example

Code Snippet

<ins-textarea
  label="Content"
  placeholder="Add your comments"
  value="This is a sample content."
  maxlength="300"
  counter="increasing"
  tooltip="This is a sample tooltip content. It also support html content.">
</ins-textarea>

<style>
  ins-textarea .ins-ta textarea {
      min-height: 120px;
      resize: none;
  }
</style>
Default State

Code Snippet

<ins-textarea></ins-textarea>
Error State

Code Snippet

<ins-textarea 
  label="Error Field" 
  has-error error-message="This is a required field">
</ins-textarea>
Disabled State

Code Snippet

<ins-textarea 
  label="Disabled Field" 
  value="You cannot edit this value" 
  Disabled>
</ins-textarea>
Read-Only State

Code Snippet

<ins-textarea 
  label="Readonly Field" 
  value="You cannot edit this value" 
  Readonly>
</ins-textarea>
Direct Value Set

Code Snippet

<ins-textarea 
  id="directFieldEl">
</ins-textarea>

<script>
  var label = "Set Data*";
  var name = "sample";
  var value = "This is a sample content.";
  var field = document.getElementById('directFieldEl');
  field.addEventListener('didLoad', function(e){
    field.name = name;
    field.label = label;
    field.value = value;
  });
</script>
Events

Code Snippet

<ins-textarea 
  id="eventFieldEl" 
  name="sample" 
  label="Content" 
  placeholder="Content placeholder">
</ins-textarea>

<script>
  let field = document.getElementById('eventFieldEl');
      field.addEventListener('oninput', event => {
        var event = event.detail;
        console.log("Textarea keypress event", event);
      });
      field.addEventListener('valueChange', event => {
        var event = event.detail;
        console.log("Value change event", event);
        alert("Check console log for event data");
      });
</script>

 

Attributes

 

FIELD ATTRIBUTE TYPE DEFAULT OPTIONS DESCRIPTION
disabled boolean false true, false Disables the field
readonly boolean false true, false Make the field readonly
has-error boolean false true, false Defines if the field is invalid / error
error-message string "" any Message shown when field has error
required boolean false true, false Specifies that the input field must be filled out before submitting the form
maxlength string "" any Defines the textarea maximum character count
counter string increasing increasing, decreasing Displays a character counter
placeholder string "" any Defines the field placeholder and shows when field is empty
label string "" any Label shown for the field
name string "" any Defines the field name
value string "" any Defines the field value
tooltip string "" - Displays a tooltip beside the label. Supports HTML Content

 

Events

 

EVENT OBJECT DESCRIPTION
insInput keyboard event Emits keyboard event on keypress
insValueChange value Emits textarea value on change

 

Have a suggestion for this page?

Didn't quite find what you are looking for or have feedback on how we can make the content better then we would love to hear from you. Please provide us feedback and we will get back to you shortly.