# Button

The button component.\
**Extends:** [`discord-components.Component`](https://devkiki7000.gitbook.io/discord-components/api-reference/componentmessage)

{% tabs %}
{% tab title="Parameters" %}

| label                                                                                                                                              |
| -------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p>The button's label. You don't have to provide this if you provided <code>emoji</code>.</p><p></p><p><strong>Type:</strong> <code>str</code></p> |

| style                                                                                                                                                                                                                                                                                                   |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p>The button's style (1 \~ 5).<br>See <a href="https://discord.com/developers/docs/interactions/message-components#buttons-button-styles">more information</a> on the discord api docs.</p><p></p><p><strong>Type:</strong> <code>str</code></p><p><strong>Default:</strong> <code>2 (Gray)</code></p> |

| id                                                                                                                               |
| -------------------------------------------------------------------------------------------------------------------------------- |
| <p>The button's custom id.</p><p>If not provided, it is a random value.</p><p></p><p><strong>Type:</strong> <code>str</code></p> |

| url                                                                                                                                         |
| ------------------------------------------------------------------------------------------------------------------------------------------- |
| <p>The button's url (this works only if the <code>style</code> is <code>5</code>).</p><p></p><p><strong>Type:</strong> <code>str</code></p> |

| disabled                                                                                                                                             |
| ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p>Indicates if the button is disabled.</p><p></p><p><strong>Type:</strong> <code>bool</code></p><p><strong>Default:</strong> <code>False</code></p> |

| emoji                                                                                 |                                   |                      |
| ------------------------------------------------------------------------------------- | --------------------------------- | -------------------- |
| <p>The button’s emoji.</p><p></p><p><strong>Type:</strong> <code>discord.Emoji</code> | <code>discord.PartialEmoji</code> | <code>str</code></p> |
| {% endtab %}                                                                          |                                   |                      |

{% tab title="Attributes" %}

| label                                                                            |
| -------------------------------------------------------------------------------- |
| <p>The button's label. </p><p></p><p><strong>Type:</strong> <code>str</code></p> |

| style                                                                                                                                                                                                                                             |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p>The button's style (1 \~ 5).<br>See <a href="https://discord.com/developers/docs/interactions/message-components#buttons-button-styles">more information</a> on the discord api docs.</p><p></p><p><strong>Type:</strong> <code>str</code></p> |

| id                                                                                  |
| ----------------------------------------------------------------------------------- |
| <p>The button's custom id.</p><p></p><p><strong>Type:</strong> <code>str</code></p> |

| url                                                                           |
| ----------------------------------------------------------------------------- |
| <p>The button's url.</p><p></p><p><strong>Type:</strong> <code>str</code></p> |

| disabled                                                                                          |
| ------------------------------------------------------------------------------------------------- |
| <p>Indicates if the button is disabled.</p><p></p><p><strong>Type:</strong> <code>bool</code></p> |

| emoji                                                                                 |                                   |                      |
| ------------------------------------------------------------------------------------- | --------------------------------- | -------------------- |
| <p>The button’s emoji.</p><p></p><p><strong>Type:</strong> <code>discord.Emoji</code> | <code>discord.PartialEmoji</code> | <code>str</code></p> |
| {% endtab %}                                                                          |                                   |                      |

{% tab title="Methods" %}

| to\_dict                                                                                                                               |
| -------------------------------------------------------------------------------------------------------------------------------------- |
| <p>Gets the component information required for API requests in dict form.</p><p></p><p><strong>Returns: <code>dict</code></strong></p> |

| from\_dict                                                                                                                                                                                                                                                                                                         |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| <p>Creates component instance from json.<br><br>This is a static method.</p><p></p><p><strong>Parameters:</strong></p><ul><li><strong>data</strong> (<code>dict</code>) - The json to construct button from.</li></ul><p><strong>Returns:</strong> <a href="button"><code>discord-components.Button</code></a></p> |
| {% endtab %}                                                                                                                                                                                                                                                                                                       |
| {% endtabs %}                                                                                                                                                                                                                                                                                                      |
