Textarea

<wa-textarea> Since 2.0 stable

Textareas collect data from the user and allow multiple lines of text.

<wa-textarea label="Type something', will ya"></wa-textarea>

This component works with standard <form> elements. Please refer to the section on form controls to learn more about form submission and client-side validation.

Examples

Labels

Use the label attribute to give the textarea an accessible label. For labels that contain HTML, use the label slot instead.

<wa-textarea label="Comments"></wa-textarea>

Hint

Add descriptive hint to a textarea with the hint attribute. For hints that contain HTML, use the hint slot instead.

<wa-textarea label="Feedback" hint="Please tell us what you think."> </wa-textarea>

Rows

Use the rows attribute to change the number of text rows that get shown.

<wa-textarea rows="2"></wa-textarea>

Placeholders

Use the placeholder attribute to add a placeholder.

<wa-textarea placeholder="Type something"></wa-textarea>

Appearance

Use the appearance attribute to change the textarea's visual appearance.

<wa-textarea placeholder="Type something" appearance="filled"></wa-textarea>

Disabled

Use the disabled attribute to disable a textarea.

<wa-textarea placeholder="Textarea" disabled></wa-textarea>

Value

Use the value attribute to set an initial value.

<wa-textarea value="Write something awesome!"></wa-textarea>

Sizes

Use the size attribute to change a textarea's size.



<wa-textarea placeholder="Small" size="small"></wa-textarea>
<br />
<wa-textarea placeholder="Medium" size="medium"></wa-textarea>
<br />
<wa-textarea placeholder="Large" size="large"></wa-textarea>

Prevent Resizing

By default, textareas can be resized vertically by the user. To prevent resizing, set the resize attribute to none.

<wa-textarea resize="none"></wa-textarea>

Expand with Content

Textareas will automatically resize to expand to fit their content when resize is set to auto.

<wa-textarea resize="auto"></wa-textarea>

Resize horizontal

Textareas can be made to resize horizontally when resize is set to "horizontal"

<wa-textarea resize="horizontal"></wa-textarea>

Resize both

Textareas can be made to resize both vertically and horizontally when resize is set to "both"

<wa-textarea resize="both"></wa-textarea>

Slots

Learn more about using slots.

Attributes & Properties

Learn more about attributes and properties.

Methods

Learn more about methods.

Events

Learn more about events.

Custom States

Learn more about custom states.

CSS parts

Learn more about CSS parts.

Importing

The autoloader is the recommended way to import components. If you prefer to do it manually, use one of the following code snippets.

CDN npm React

To manually import this component from the CDN, use the following code.

import 'https://early.webawesome.com/webawesome@3.0.0-beta.2/dist/components/textarea/textarea.js';

To manually import this component from NPM, use the following code.

import '@awesome.me/webawesome/dist/components/textarea/textarea.js';

To manually import this component from React, use the following code.

import '@awesome.me/webawesome/dist/react/textarea';
Need a hand? Report a bug Ask for help
    No results