Title: Input Textarea Field
Description: A primitive <textarea> element.
prc-block/form-input-textarea
forms
| Feature | Enabled | Details |
|---|---|---|
| Anchor | Yes | |
| HTML editing | No | |
| Reusable | No | |
| Interactivity | Yes | |
| Layout | Yes | Flex layout with vertical orientation; supports orientation, justification, vertical alignment, and sizing on children |
| Spacing | Yes | blockGap, padding, margin |
| Border | Yes | Color, width, radius (skip serialization) |
| Color | Yes | Background, text, contrast checker (skip serialization) |
| Typography | Yes | Font size, line height, font family, font weight, font style, text transform, text decoration, letter spacing |
| Custom selectors | Yes | Root: .wp-block-prc-block-form-input-textarea; color/border target > textarea |
| Attribute | Type | Default | Description |
|---|---|---|---|
displayLabel |
boolean |
true |
Whether to show the label above the textarea |
label |
string |
— | Label text (sourced from the <label> HTML element) |
placeholder |
string |
"A hint or example..." |
Placeholder text shown when the textarea is empty |
value |
string |
— | The current value of the textarea |
required |
boolean |
false |
Whether the field is required for form submission |
maxLength |
number |
1000 |
Maximum number of characters allowed |
minLength |
number |
10 |
Minimum number of characters required |
rows |
number |
4 |
Number of visible text lines |
cols |
number |
20 |
Number of visible characters per line |
wrap |
string |
— | Text wrapping behavior: "hard", "soft", or "off" |
The block also uses metadata.name (from the block bindings metadata) as the input's name attribute for form submission data.
| Style | Label | Default |
|---|---|---|
default |
Default | Yes |
inline-label |
Inline Label | No |
The Inline Label style displays the label and textarea side-by-side in a horizontal flex layout with shared border styling on the wrapper instead of the textarea.
None. This is a leaf block.
None. Can be placed anywhere, but typically used inside a prc-block/form or prc-block/form-page.
- Add the block to your form layout.
- Enter a label using the inline RichText editor (the label auto-generates a camelCase
namefor form data). - Configure field settings in the Inspector Panel:
- Input Name -- Override the auto-generated camelCase name for the field in form submissions.
- Input Placeholder -- Customize the hint text.
- Required -- Toggle whether this field must be filled before submission.
- Max/Min Length -- Set character limits.
- Rows/Cols -- Control the visible textarea size.
- Wrap -- Choose hard, soft, or off wrapping behavior.
- Use the "Inline Label" style variation for a compact, horizontal label+textarea layout.
<div class="wp-block-prc-block-form-input-textarea">
<label>Message</label>
<textarea
name="message"
placeholder="Enter your message"
required
maxlength="1000"
minlength="10"
rows="4"
cols="20"
></textarea>
</div>Server-side rendered via render_block_callback in Form_Input_Textarea. The PHP:
- Assigns a unique
idto the textarea (e.g.,prc-block-form-input-textarea-1). - Binds the label's
forattribute to the textarea'sid. - Adds WordPress Interactivity API directives to the textarea:
- Event handlers:
mouseenter,mouseleave,keyup,focus,blur - Property bindings:
required,value,placeholder,hidden,readonly,disabled - State classes:
is-disabled,is-error,is-success,is-processing
- Event handlers:
- Registers the field into the parent form's
formFieldsinteractivity state array with itsid,name,label,type(textarea),value,required, andplaceholder. - Supports a configurable interactive namespace (defaults to
prc-block/form) and optional subsumption mode.
No standalone view.js. Interactivity is handled by the parent form's interactivity store (prc-block/form), which manages field state, validation, and submission through the directives added in PHP.
prc-block/form-- Parent form containerprc-block/form-input-text-- Text input field (single-line counterpart)prc-block/form-page-- Multi-page form paginationprc-block/form-submit-- Form submission actionsprc-block/form-message-- Post-submission message display