addText method

void addText(
  1. String text
)

Adds non-editable text to the modal.

Creates a text display component that shows informational text without user input. Useful for instructions, warnings, or contextual information.

The text supports Discord markdown formatting for rich text display.

Example

modal
  ..addText('**Important**: Please read the guidelines before submitting.')
  ..addText('All fields marked with * are required.')
  ..addTextInput(
    customId: 'feedback',
    label: 'Your Feedback *',
    style: TextInputStyle.paragraph,
  );

Implementation

void addText(String text) {
  _components.add(TextDisplay(text));
}