Discord Components V2 for discord.py
Project description
.----..-. .-. .---. .----. .-. .-..----. .----. .-. .-..----..-. .-. .---. .----.
| {} }\ \/ / / ___}/ {} \| `.' || {} }/ {} \| `| || {_ | `| |{_ _}{ {__
| .--' } { \ }\ /| |\ /| || .--' \ /| |\ || {__ | |\ | | | .-._} }
`-' `--' `---' `----' `-' ` `-'`-' `----' `-' `-'`----'`-' `-' `-' `----'
py-components is a lightweight Python library that provides helpers for building Discord Components (Buttons, Select Menus, Action Rows) for use with discord.py.
It is designed to simplify the creation and handling of Discord UI components while keeping the API clean, minimal, and easy to extend.
Features
- Simple Discord Components V2 wrapper
- Easy-to-use Button, Select Menu, and Action Row builders
- Async-friendly design
- Clean and readable API
- Built to integrate with
discord.py
Installation
pip install py-components
Requirements
- Python 3.10+
- discord.py (latest recommended)
- aiohttp
Quick Start
Creating a Button
from py_components import Button, ActionRow
button = Button(
label="Click Me",
style="primary",
custom_id="click_me_button"
)
row = ActionRow(components=[button])
Handling Interactions
from py_components import Button
button = Button(
label="Hello",
style="success",
custom_id="hello_button"
)
async def handle_interaction(interaction):
await interaction.response.send_message("You clicked the button!")
Components
Buttons
Supported styles:
- primary
- secondary
- success
- danger
Button(
label="Delete",
style="danger",
custom_id="delete_btn"
)
Select Menus
from py_components import SelectMenu
menu = SelectMenu(
custom_id="menu_example",
options=[
{"label": "Option 1", "value": "opt1"},
{"label": "Option 2", "value": "opt2"}
]
)
Action Rows
Used to group components together.
from py_components import ActionRow
row = ActionRow(components=[button, menu])
Example Usage
from py_components import Button, ActionRow, SelectMenu
button = Button(
label="Click Me",
style="primary",
custom_id="btn_1"
)
menu = SelectMenu(
custom_id="menu_1",
options=[
{"label": "Red", "value": "red"},
{"label": "Blue", "value": "blue"}
]
)
row = ActionRow(components=[button, menu])
Roadmap
- Modal support
- Full discord.py integration helpers
- Prebuilt UI templates
- Advanced component event handling
- Stronger typing + validation
- More Discord component types support
Project Structure
py-components/
├── py_components/
│ ├── __init__.py
│ ├── buttons.py
│ ├── select.py
│ └── components.py
├── README.md
├── pyproject.toml
└── LICENSE
License
MIT License
Notes
This library is a helper layer for building Discord UI components more efficiently. It does not replace discord.py, but extends it with easier component creation utilities.
--
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file discordpycomponents-0.2.2.tar.gz.
File metadata
- Download URL: discordpycomponents-0.2.2.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
21fa02d6bdf42eb143940d3ffcd81041266427628009cc8c9069c4d8ddd331a4
|
|
| MD5 |
2850d7fe3198d9c9afd4b9f41428cef2
|
|
| BLAKE2b-256 |
18667c156ae45162907222f05df681b06d3739e81263a1e0b2363edd24c2779c
|
Provenance
The following attestation bundles were made for discordpycomponents-0.2.2.tar.gz:
Publisher:
publish.yml on 2gm49/py-components
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
discordpycomponents-0.2.2.tar.gz -
Subject digest:
21fa02d6bdf42eb143940d3ffcd81041266427628009cc8c9069c4d8ddd331a4 - Sigstore transparency entry: 1365181290
- Sigstore integration time:
-
Permalink:
2gm49/py-components@7d48ca3c63e29aed0db9ae16265e707c1e12db74 -
Branch / Tag:
refs/tags/v0.2.22 - Owner: https://github.com/2gm49
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7d48ca3c63e29aed0db9ae16265e707c1e12db74 -
Trigger Event:
push
-
Statement type:
File details
Details for the file discordpycomponents-0.2.2-py3-none-any.whl.
File metadata
- Download URL: discordpycomponents-0.2.2-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7c9cd61124300b8ac14b269f5e1a70f0becf271ca49a36a051416c5b938f6a1f
|
|
| MD5 |
e2e7a94635a39a154863b0b9d0201a67
|
|
| BLAKE2b-256 |
a8a545b99bad8bd5484a173e6f2621ec246be244f61f23d0d5692b6807c2c9ce
|
Provenance
The following attestation bundles were made for discordpycomponents-0.2.2-py3-none-any.whl:
Publisher:
publish.yml on 2gm49/py-components
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
discordpycomponents-0.2.2-py3-none-any.whl -
Subject digest:
7c9cd61124300b8ac14b269f5e1a70f0becf271ca49a36a051416c5b938f6a1f - Sigstore transparency entry: 1365181342
- Sigstore integration time:
-
Permalink:
2gm49/py-components@7d48ca3c63e29aed0db9ae16265e707c1e12db74 -
Branch / Tag:
refs/tags/v0.2.22 - Owner: https://github.com/2gm49
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7d48ca3c63e29aed0db9ae16265e707c1e12db74 -
Trigger Event:
push
-
Statement type: