You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

03-buttons-in-depth.md 1.6 KiB

3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. ---
  2. uid: Guides.MessageComponents.Buttons
  3. title: Buttons in Depth
  4. ---
  5. # Buttons in depth
  6. There are many changes you can make to buttons, lets take a look at the parameters in the `WithButton` function"
  7. | Name | Type | Description |
  8. |----------|---------------|----------------------------------------------------------------|
  9. | label | `string` | The label text for the button. |
  10. | customId | `string` | The custom id of the button. |
  11. | style | `ButtonStyle` | The style of the button. |
  12. | emote | `IEmote` | A IEmote to be used with this button. |
  13. | url | `string` | A URL to be used only if the `ButtonStyle` is a Link. |
  14. | disabled | `bool` | Whether or not the button is disabled. |
  15. | row | `int` | The row to place the button if it has enough room, otherwise 0 |
  16. ### Label
  17. This is the front facing text that the user sees. The maximum length is 80 characters.
  18. ### CustomId
  19. This is the property sent to you by discord when a button is clicked. It is not required for link buttons as they do not emit an event. The maximum length is 100 characters.
  20. ### Style
  21. Styling your buttons are important for indicating different actions:
  22. ![](Images/image3.png)
  23. You can do this by using the `ButtonStyle` which has all the styles defined.
  24. ### Emote
  25. You can specify an `IEmote` when creating buttons to add them to your button. They have the same restrictions as putting guild based emotes in messages.
  26. ### Url
  27. If you use the link style with your button you can specify a url. When this button is clicked the user is taken to that url.
  28. ### Disabled
  29. You can specify if your button is disabled, meaning users won't be able to click on it.