Modals¶
Overview¶
Modals are defined by annotating a method with @Modal
.
The first parameter must always be a ModalEvent
.
Text Inputs¶
You can add text inputs to a modal by adding String parameters annotated with @TextInput
.
The label and other metadata of the text input is passed to the annotation.
Tip
Just as for command options, the parameter name will be used for the label by default. However, this requires the
-parameters
compiler flag to be enabled.
Text Inputs can be configured with the following fields:
style¶
Sets the TextInputStyle
.
The default value is TextInputStyle.PARAGRAPH
.
Example
placeholder¶
Sets the placeholder of a text input.
Example
defaultValue¶
Sets the default value of a text input, which will pre-populate the text input field with the specified String.
Example
minValue & maxValue¶
Sets the minimum and maximum input length of a text input.
Example
required¶
Sets whether the text input is required. The default value is true
.
Example
Replying with Modals¶
You can reply to CommandEvents
and ComponentEvents
with a Modal by calling replyModal(methodName)
on the event.