Max 45 characters

Used to identify the modal in your code

Input 1

Feedback Form

10-1000 characters

// Discord.js - Show Modal
const { ModalBuilder, TextInputBuilder, TextInputStyle, ActionRowBuilder } = require('discord.js');

// Create the modal
const modal = new ModalBuilder()
  .setCustomId('feedback_modal')
  .setTitle('Feedback Form');

// Text Input 1
const feedback_input = new TextInputBuilder()
  .setCustomId('feedback_input')
  .setLabel('What is your feedback?')
  .setStyle(TextInputStyle.Paragraph)
  .setPlaceholder('Enter your feedback here...')
  .setRequired(true)
  .setMinLength(10)
  .setMaxLength(1000);

const row1 = new ActionRowBuilder().addComponents(feedback_input);

// Add inputs to the modal
modal.addComponents(row1);

// Show the modal
await interaction.showModal(modal);
// Discord.js - Handle Modal Submission

client.on('interactionCreate', async (interaction) => {
  if (!interaction.isModalSubmit()) return;
  if (interaction.customId !== 'feedback_modal') return;

  // Get the values from the modal
  const feedback_input = interaction.fields.getTextInputValue('feedback_input');

  // Process the data
  console.log('Modal submitted:');
  console.log('What is your feedback?:', feedback_input);

  // Send response
  await interaction.reply({
    content: 'Thank you for your submission!',
    ephemeral: true
  });
});

💡Quick Tips

  • Modals can have a maximum of 5 text inputs
  • Modal titles are limited to 45 characters
  • Text input values can be up to 4000 characters
  • Modals must be shown in response to an interaction (button, slash command, etc.)
  • You have 15 minutes to respond to a modal submission
  • Custom IDs must be unique within your bot to avoid conflicts
  • Use paragraph style for longer text and short style for single-line inputs
Powered by Mamba Host