1. Fields
  2. Smart Text Field

Fields

Smart Text Field

The smart_text field allows you to enable autocompletions and syntax highlighting in your text.

This field can be used to add suggestions to any text field.
The suggestions will be displayed as the user types, and the user can select one of the suggestions to complete the text.

Basic usage

Adds a smart_text field to the fields of an action.
This field will show autocompletions when the user types @ or presses Ctrl+Space.

loading...

Result

The field will be displayed as a text input field as below: Preview of a smart_text field in a form

The resultant data will be available in the stubpost.data as:

loading...

This can be substituted with eg. ~~stubpost.data.smart_text_mention_field where required.

Parameters

See fields for common field parameters like validation and conditional rendering.

params.parse_string

If set to true, string values will be parsed and the field's output will be a number or a boolean when parsed successfully.

Default: false


params.code_language

optional

Adds syntax highlighting for the chosen language.
Currently only 'handlebars' is supported.


params.auto_completions

optional

An array of auto_completion objects that define the autocompletions for the field.


auto_completion.explicit

optional

If set to true, the associated options will be shown when the user presses Ctrl+Space.


auto_completion.match_before

optional

A regex expression/character that will trigger the autocompletions panel to appear.


auto_completion.options

An array of objects that define the autocompletions for the field.
The properties defined on codemirror.net's Completion interface are supported.