ContentBlocks ContentBlocks 2.x Input Types Text
The text input type is a visual editable text field, allowing a single line of text without line breaks. This input type is especially useful for simple text inputs and when combined with other inputs in a block.
Table of Contents
Accepted properties
styles: an object of css styles to apply to the text.maxlengthinteger of the minimum length in charactersminlengthinteger of the minimum length in characterspatternregex validation pattern
Returned values
value: the text that was entered
Example block
{
"title": "Text",
"inputs": {
"text": {
"type": "text",
"properties": {
"styles": {
"--cb-text-color": "#999"
}
}
}
}
}
Example template structures
Twig
{% if text.value %}
<p class="cb-text">{{ text.value }}</p>
{% endif %}
tpl
[[+text.value:notempty=`<p class="cb-text">[[+text.value]]</p>`]]
Simple text formatting
Use the MiniRTE plugin to add basic inline text formatting in a text field. See MiniRTE.