Textarea

The Textarea field creates a multi-line text input option for the block, suitable for paragraphs.

Settings

  • Help Text: Instructions to describe the data needed in the field.
  • Default Value: The default value for this field when adding the block.
  • Placeholder Text: The helper text which appears when the input is empty.
  • Character Limit: The maximum number of characters allowed to be entered.
  • Number of Rows: The height of the textarea when displayed in the editor.
  • New Lines: Automatically add paragraphs or line breaks or choose no formatting.

PHP API Controls

  • name
  • label
  • control
  • type
  • order
  • location
  • width
  • help
  • default
  • placeholder
  • maxlength
  • number_rows
  • new_lines

Template Usage

To display the Textarea field in your template, use the field name you provided.

<?php block_field( 'pets-story' ); ?>

The API will return a string.

Example template file /blocks/block-block-lab-example.php

<?php
// Block Lab Example Textarea Field
?>
 
<h2>Pet's Story</h2>
 <p><?php block_field( 'pets-story' ); ?></p>

To use the block with the Textarea field on your site, locate it in the blocks menu.

Screenshot showing the Block Lab custom block in the menu

It will then display within your post/page.

And on the front-end of your site.