Magnolia 5.6 reached end of life on June 25, 2020. This branch is no longer supported, see End-of-life policy.
The expanding text field is provided by the Content Editor module, which is an EE Pro module.
The ExpandingTextFieldDefinition is similar to the placeholder text field and provides an additional property named maxRows
. (Note that this field indirectly extends the text field, which has the rows
property.)
As the name of the field suggests, the field's vertical size expands proportionally with the increasing amount of the text entered, until it reaches the value of the maxRows
property at which point a scroll bar will appear.
class: info.magnolia.editor.app.field.ExpandingTextFieldDefinition
The expanding text field is useful in the apps based on the Content editor such as the Stories app:
Before selecting the field
Selected
With the initial number of rows
With the maximum number of rows
With a scroll bar
The field can also be used in a dialog for a component:
It works in exactly the same way as in a Content editor app. (Not showing all states here.)
authorBio: class: info.magnolia.editor.app.field.ExpandingTextFieldDefinition rows: 2 maxRows: 5 # label: Author biography # placeholder: Provide some info about the author ...
Node name | Value |
---|---|
fields | |
authorBio | |
class | info.magnolia.editor.app.field.ExpandingTextFieldDefinition |
rows | 2 |
maxRows | 5 |
You can use the placeholder text field properties and the maxRows
property in the field's definition:
<field name> | The name of field. |
| optional, default is The maximum number of rows to which the field may expand before showing a scroll bar. |
| optional , default is The number of text rows for the initial state of the field. This property is defined in TextFieldDefinition . |
You should provide translations for the placeholder
and label
properties. (Make use of the auto-generated 18n keys and provide the translations in a message bundle.)