Skip to content

textarea

Renders a <textarea> element with automatic content re-population from submitted form data.

Usage

liquid
{% textarea name: 'message', class: 'form-control' %}

Options

All standard HTML textarea attributes are supported, including data- attributes. Pass them as key/value pairs.

OptionDescription
nameField name. Used to auto-populate content from submitted form data.
idID attribute.
classCSS classes.
textDefault text content. Overridden automatically if a submitted value exists.
placeholderPlaceholder text.
requiredPass required: 'required' to mark the field as required.
data-*Any data- attributes are supported, e.g. data-foo: 'bar'.

WARNING

Attributes without values are ignored — use required: 'required' rather than required alone.

Auto-population

When a name is set, the textarea content is automatically restored from submitted form data after a failed submission.

Example

liquid
{% textarea name: 'message', class: 'form-control', placeholder: 'Your message', required: 'required' %}