Socket
Book a DemoInstallSign in
Socket

v2modalbuilder

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

v2modalbuilder

A discord.js v2components builder

1.0.2
latest
Source
npmnpm
Version published
Weekly downloads
192
Maintainers
1
Weekly downloads
 
Created
Source

V2 Discord Modal Builder

A TypeScript-first builder library for Discord's experimental V2 Modals and components.
It provides strongly typed, chainable builders for creating full-screen modals with labels, text inputs, and select menus — with zero raw JSON hassle.

🔗 Reference: Discord Developer Docs – Components
🔗 Support/Hangout Discord: Golden Development
🔗 My YouTube Channel: Golden Development
🔗 My Discord Bot: Golden Bot

✨ Features

  • Build Discord V2 Modals with type safety
  • Chainable, ergonomic API
  • Label (type 18) wrapper component support
  • Works with discord.js, raw REST, or any API client
  • Outputs valid Discord API payloads

🧱 Included Builders

ComponentBuilder ClassDescription
ModalV2ModalBuilderDefine custom_id, title, and child components
Label Wrapper (18)V2LabelBuilderPairs a label/description with an inner component
Text InputV2TextInputBuilderModal text fields (short/paragraph)
String SelectV2StringSelectBuilderDropdowns inside a label wrapper

📦 Installation

npm install v2modalbuilder
import {
  V2ModalBuilder,
  V2LabelBuilder,
  V2TextInputBuilder,
  V2StringSelectBuilder,
} from "v2modalbuilder";
import { TextInputStyle } from "discord-api-types/v10";

const modal = new V2ModalBuilder()
  .setCustomId("bug_modal")
  .setTitle("Bug Report")
  .addComponents(
    new V2LabelBuilder()
      .setLabel("What's your favorite bug?")
      .setComponent(
        new V2StringSelectBuilder()
          .setCustomId("bug_string_select")
          .setPlaceholder("Choose...")
          .addOptions(
            { label: "Ant", value: "ant", description: "(best option)", emoji: { name: "🐜" } },
            { label: "Butterfly", value: "butterfly", emoji: { name: "🦋" } },
            { label: "Caterpillar", value: "caterpillar", emoji: { name: "🐛" } }
          )
      ),
    new V2LabelBuilder()
      .setLabel("Why is it your favorite?")
      .setDescription("Please provide as much detail as possible!")
      .setComponent(
        new V2TextInputBuilder()
          .setCustomId("bug_explanation")
          .setStyle(TextInputStyle.Paragraph)
          .setMinLength(1000)
          .setMaxLength(4000)
          .setPlaceholder("Write your explanation here...")
          .setRequired(true)
      )
  );

interaction.showModal(modal);

Keywords

discord

FAQs

Package last updated on 27 Aug 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.