---
title: "Text"
description: "Add Text control to your custom blocks for WordPress using the Lazy Blocks plugin."
url: "https://www.lazyblocks.com/docs/blocks-controls/text/"
lastUpdated: 2026-09-09
source: "blocks-controls/text.mdx"
---
# Text

Text control provides a simple input field for single-line text content. It's perfect for headings, titles, or any short text input.

## Control Settings

- **Placeholder** (`placeholder`) - text shown when the field is empty. Empty by default
- **Characters Limit** (`characters_limit`) - the `maxlength` put on the input, from 0 to 524288. Empty by default, which is no limit

## Usage Examples

### Basic Output

```php title="PHP" /$attributes['control_name']/
<h2 class="title">
    <?php echo esc_html( $attributes['control_name'] ); ?>
</h2>
```

```hbs title="Handlebars" /{{control_name}}/
<h2 class="title">
  {{control_name}}
</h2>
```

### With HTML Attributes

```php title="PHP" /$attributes['control_name']/
<a href="#" title="<?php echo esc_attr( $attributes['control_name'] ); ?>">
    Link with title
</a>
```

### Post Meta

```php title="Post Meta" /get_lzb_meta( 'control_meta_name' )/
<?php
$text = get_lzb_meta( 'control_meta_name' );
if ( $text ) {
    echo '<h2 class="title">' . esc_html( $text ) . '</h2>';
}
?>
```

Always use proper escaping functions:
- `esc_html()` for regular text output
- `esc_attr()` for HTML attributes

## Documentation Index
> Fetch the complete documentation index at: https://www.lazyblocks.com/llms.txt
> Fetch every page in a single file at: https://www.lazyblocks.com/llms-full.txt
