Buttons

How to use Buttons with Pycord

Docs: https://pycord.readthedocs.io/en/master/api.html#discord.Button

Credits: https://gist.github.com/MhmCats/500eafdad0aaf278b94c612764688976

Button Attributes

Sub-Classing discord.ui.View

Sub-Classing discord.ui.Button

Using buttons with subclassing

Button Styles

Button styles can be one of these

Styles

Name

Usage

Color

Primary

discord.ButtonStyle.primary

Blurple

Secondary

discord.ButtonStyle.secondary

Grey

Success

discord.ButtonStyle.success

Green

Danger

discord.ButtonStyle.danger

Red

Link

discord.ButtonStyle.link

Grey

URL Buttons

Disabling Buttons

Disabling Buttons on Click

Here's how you can disable a single button or multiple buttons on press:

Making Pre-Disabled Buttons

Timeouts

You probably wanna set a timeout too, and its quite simple, really!

Rows

A message can have up to five "action rows" and each of these "action" rows have five slots where you can put message components. A button takes up one of these slots but a select menus takes up all five slots of a "action row". Keep this in mind when creating your views since you don't want to run out of space!

Last updated

Was this helpful?