Create Discord Components v2 interactive messages with buttons, select menus, and containers. Use when you need user confirmations, selections, or action tri...
Use Discord Components v2 to create interactive messages with buttons and select menus for asynchronous user interactions.
message(
action="send",
channel="discord",
target="channel:CHANNEL_ID",
components={
"type": "container",
"accent_color": 0x3498db,
"components": [
{"type": "text_display", "content": "**Confirm action?**"},
{"type": "action_row", "components": [
{"type": "button", "custom_id": "yes", "label": "✅ Yes", "style": "success"},
{"type": "button", "custom_id": "no", "label": "❌ No", "style": "secondary"}
]}
]
}
)
| Component | Use For | See |
|---|---|---|
button | Single actions | references/components.md |
string_select | Multiple options | references/components.md |
container | Layout + styling | references/components.md |
When user clicks, check message.interaction.custom_id:
if message.get("interaction", {}).get("custom_id") == "yes":
# Execute confirmed action
pass
See references/handling.md for full callback examples.
components with embeds (Discord rejects)custom_id to identify button clicksaccent_color (hex) for visual distinctionSee references/examples.md for complete use cases:
ZIP package — ready to use