Chi Documentation

Textarea

Textareas are used to input multi-line text data

Examples

To render a textarea, apply the class a-input to a textarea.

Base

<textarea class="a-input">
  Sample text
</textarea>

Disabled

<textarea class="a-input" disabled>
  Sample text
</textarea>

Icons

To add icons to a textarea, wrap the input in a div using the class a-inputWrapper. Next, add the icon as a sibling of the textarea and use an icon alignment utility class (e.g. -icon--left) to specify where it should be placed.

Left Aligned

<div class="a-inputWrapper -icon--left">
  <textarea class="a-input">
    Sample text
  </textarea>
  <div class="a-icon -text--muted">
    <svg>
      <use xlink:href="#icon-edit"></use>
    </svg>
  </div>
</div>

Right Aligned

<div class="a-inputWrapper -icon--right">
  <textarea class="a-input">
    Sample text
  </textarea>
  <div class="a-icon -text--muted">
    <svg>
      <use xlink:href="#icon-edit"></use>
    </svg>
  </div>
</div>

Left + Right Aligned

<div class="a-inputWrapper -icon--left -icon--right">
  <textarea class="a-input">
    Sample text
  </textarea>
  <div class="a-icon -text--muted">
    <svg>
      <use xlink:href="#icon-edit"></use>
    </svg>
  </div>
  <div class="a-icon -text--muted">
    <svg>
      <use xlink:href="#icon-check"></use>
    </svg>
  </div>
</div>

States

Textareas offer three validation states: -success, -warning, and -danger.

Success

<textarea class="a-input -success">
  Sample text
</textarea>
<div class="a-inputWrapper -icon--right">
  <textarea class="a-input -success">
    Sample text
  </textarea>
  <div class="a-icon -text--success">
    <svg>
      <use xlink:href="#icon-check"></use>
    </svg>
  </div>
</div>

Warning

<textarea class="a-input -warning">
  Sample text
</textarea>
<div class="a-inputWrapper -icon--right">
  <textarea class="a-input -warning">
    Sample text
  </textarea>
  <div class="a-icon -text--warning">
    <svg>
      <use xlink:href="#icon-warning"></use>
    </svg>
  </div>
</div>

Danger

<textarea class="a-input -danger">
  Sample text
</textarea>
<div class="a-inputWrapper -icon--right">
  <textarea class="a-input -danger">
    Sample text
  </textarea>
  <div class="a-icon -text--danger">
    <svg>
      <use xlink:href="#icon-circle-warning"></use>
    </svg>
  </div>
</div>

Sizes

Textareas supports a full spectrum of sizes: -sm, -md, -lg, -xl. The default size is -md.

<textarea class="a-input -sm">
  Sample text
</textarea>
<textarea class="a-input -md">
  Sample text
</textarea>
<textarea class="a-input -lg">
  Sample text
</textarea>
<textarea class="a-input -xl">
  Sample text
</textarea>