Discord Discord Message Component Builders for Discord.js
This repository contains TypeScript builders for crafting Discord Message Components with full type safety, clean structure, and reusable patterns.
It wraps raw Discord API component structures into easy-to-use, chainable builders designed for use in bots, utilities, or frameworks.
🔗 Reference: Discord Developer Docs – Message Components
🔗 Support/Hangout Discord: Altvine
🔗 My Discord Bot: Merlin
🧱 Included Builders
Each builder corresponds to a Discord component type, with smart defaults, validation, and clear APIs.
Button | ButtonBuilder | Build styled, interactive buttons with labels, emojis, custom IDs, and URLs. |
String Select | StringSelectBuilder | Create menus with up to 25 options using custom labels, values, emojis, etc. |
User Select | UserSelectBuilder | Select one or more users from the server dynamically. |
Role Select | RoleSelectBuilder | Let users choose one or more server roles. |
Mentionable Select | MentionableSelectBuilder | Select users or roles with a unified component. |
Channel Select | ChannelSelectBuilder | Choose from specific types of server channels (text, voice, etc.). |
Action Row | ActionRowBuilder | Compose select menus or buttons into Discord action rows. |
Container | ContainerBuilder | A utility for grouping components together. |
Media Gallery | MediaGallery | Utility to bundle media content. |
Section / Separator | SectionBuilder , Separator | Display structured sections and dividers. |
File & Thumbnail | File , Thumbnail | Attach files or images. |
Text Displays | TextDisplay | Render text blocks inside components. |
📦 Installation
Clone or copy this directory into your bot or utility project. It is framework-agnostic and works with any method that sends raw Discord payloads (e.g., REST, Interactions API, libraries like discord.js
, harmony
, etc.). Originally designed to be used with discord.js.
import { Builder, TextDisplay } from 'discord-components';
const components = new Builder().addComponents([
new TextDisplay("Testing"),
]);
sendMessage(components.toJSON());