Skip to content

Button

type: 2 Messages

The Button is something the user can click. It goes inside an Action Row or as the accessory of a Section.

Preview
My BotAPPToday at 12:00 PM
payload.json
{
"flags": 32768,
"components": [
{
"type": 1,
"components": [
{
"type": 2,
"style": 1,
"label": "Primary",
"custom_id": "b1"
},
{
"type": 2,
"style": 2,
"label": "Secondary",
"custom_id": "b2"
},
{
"type": 2,
"style": 3,
"label": "Success",
"custom_id": "b3"
},
{
"type": 2,
"style": 4,
"label": "Danger",
"custom_id": "b4"
},
{
"type": 2,
"style": 5,
"label": "Link",
"url": "https://discord.com"
}
]
},
{
"type": 1,
"components": [
{
"type": 2,
"style": 6,
"sku_id": "1234567890123456789"
},
{
"type": 2,
"style": 2,
"label": "Disabled",
"custom_id": "b6",
"disabled": true
},
{
"type": 2,
"style": 2,
"label": "With emoji",
"custom_id": "b7",
"emoji": {
"name": "🎉"
}
}
]
}
]
}
Style Value Requires Recommended use
Primary 1 custom_id The main action. Only one per group.
Secondary 2 custom_id Secondary or equal-weight actions.
Success 3 custom_id Positive actions (confirm, accept).
Danger 4 custom_id Dangerous or irreversible actions (delete, kick).
Link 5 url Opens a website. Does not send an interaction to your bot.
Premium 6 sku_id Purchase one of your app’s products. Does not send an interaction.
Field Type Description
type integer required Always 2.
id integer optional Unique identifier.
style integer required Button style (table above).
label string optional Button text. Max 80 characters.
emoji partial emoji optional { "name": "🎉" } or { "name": "name", "id": "123" }.
custom_id string What your bot receives on click. 1-100 characters. required for styles 1-4, not allowed for 5 and 6.
url string URL to open. Max 512 characters. required for Link (5).
sku_id snowflake Product ID. required for Premium (6).
disabled boolean optional Disable the button. Defaults to false.
{
"type": 1,
"components": [
{ "type": 2, "style": 1, "label": "Confirm", "custom_id": "confirm", "emoji": { "name": "✅" } },
{ "type": 2, "style": 5, "label": "Website", "url": "https://discord.com" },
{ "type": 2, "style": 6, "sku_id": "1234567890123456789" }
]
}

Your bot receives an interaction with data.custom_id and data.component_type = 2. Learn how to respond in Interactions.

  • The custom_id must be unique within the message.
  • Use disabled: true to show a button that can’t be used yet (for example “Next” on the last page).
  • Custom emojis need both id and name: { "name": "pepe", "id": "123456789012345678" }.