From e7b6ef688ea84cb0ce87bc7e0d89433863b78e3b Mon Sep 17 00:00:00 2001 From: Soheab_ <33902984+Soheab@users.noreply.github.com> Date: Wed, 10 Sep 2025 22:58:35 +0200 Subject: [PATCH] Corrections in various component docs --- discord/components.py | 1 + discord/ui/file.py | 3 ++- discord/ui/label.py | 4 +++- discord/ui/media_gallery.py | 3 ++- discord/ui/section.py | 3 ++- discord/ui/select.py | 2 ++ discord/ui/separator.py | 3 ++- discord/ui/text_display.py | 3 ++- discord/ui/text_input.py | 2 ++ 9 files changed, 18 insertions(+), 6 deletions(-) diff --git a/discord/components.py b/discord/components.py index 08ae4f277..06f2a7914 100644 --- a/discord/components.py +++ b/discord/components.py @@ -131,6 +131,7 @@ class Component: - :class:`FileComponent` - :class:`SeparatorComponent` - :class:`Container` + - :class:`LabelComponent` This class is abstract and cannot be instantiated. diff --git a/discord/ui/file.py b/discord/ui/file.py index 92b927ac0..62b58608b 100644 --- a/discord/ui/file.py +++ b/discord/ui/file.py @@ -46,7 +46,8 @@ __all__ = ('File',) class File(Item[V]): """Represents a UI file component. - This is a top-level layout component that can only be used on :class:`LayoutView`. + This is a top-level layout component that can only be used on :class:`LayoutView`, + or :class:`Container`. .. versionadded:: 2.6 diff --git a/discord/ui/label.py b/discord/ui/label.py index 7a2d496a6..3f6b872a9 100644 --- a/discord/ui/label.py +++ b/discord/ui/label.py @@ -50,6 +50,8 @@ V = TypeVar('V', bound='BaseView', covariant=True) class Label(Item[V]): """Represents a UI label within a modal. + This is a top-level layout component that can only be used on :class:`Modal`. + .. versionadded:: 2.6 Parameters @@ -60,7 +62,7 @@ class Label(Item[V]): description: Optional[:class:`str`] The description text to display right below the label text. Can only be up to 100 characters. - component: Union[:class:`discord.ui.TextInput`, :class:`discord.ui.Select`] + component: Union[:class:`discord.ui.TextInput`, :class:`discord.ui.Select`, :class:`discord.ui.UserSelect`, :class:`discord.ui.RoleSelect`, :class:`discord.ui.MentionableSelect`, :class:`discord.ui.ChannelSelect`] The component to display below the label. id: Optional[:class:`int`] The ID of the component. This must be unique across the view. diff --git a/discord/ui/media_gallery.py b/discord/ui/media_gallery.py index 0a6aea151..609908e8f 100644 --- a/discord/ui/media_gallery.py +++ b/discord/ui/media_gallery.py @@ -51,7 +51,8 @@ class MediaGallery(Item[V]): Can contain up to 10 :class:`.MediaGalleryItem`\s. - This is a top-level layout component that can only be used on :class:`LayoutView`. + This is a top-level layout component that can only be used on :class:`LayoutView`, + or :class:`Container`. .. versionadded:: 2.6 diff --git a/discord/ui/section.py b/discord/ui/section.py index 67d35e001..0225df02e 100644 --- a/discord/ui/section.py +++ b/discord/ui/section.py @@ -46,7 +46,8 @@ __all__ = ('Section',) class Section(Item[V]): r"""Represents a UI section. - This is a top-level layout component that can only be used on :class:`LayoutView`. + This is a top-level layout component that can only be used on :class:`LayoutView`, + or :class:`Container`. .. versionadded:: 2.6 diff --git a/discord/ui/select.py b/discord/ui/select.py index 7a3d9c95e..0b4d0ba31 100644 --- a/discord/ui/select.py +++ b/discord/ui/select.py @@ -392,6 +392,8 @@ class Select(BaseSelect[V]): """Represents a UI select menu with a list of custom options. This is represented to the user as a dropdown menu. + This can only be used in :class:`ActionRow` or :class:`Label`. + .. versionadded:: 2.0 Parameters diff --git a/discord/ui/separator.py b/discord/ui/separator.py index e6dc61f00..88a2cdb47 100644 --- a/discord/ui/separator.py +++ b/discord/ui/separator.py @@ -43,7 +43,8 @@ __all__ = ('Separator',) class Separator(Item[V]): """Represents a UI separator. - This is a top-level layout component that can only be used on :class:`LayoutView`. + This is a top-level layout component that can only be used on :class:`LayoutView`, + or :class:`Container`. .. versionadded:: 2.6 diff --git a/discord/ui/text_display.py b/discord/ui/text_display.py index b6f908748..4abff1a18 100644 --- a/discord/ui/text_display.py +++ b/discord/ui/text_display.py @@ -43,7 +43,8 @@ __all__ = ('TextDisplay',) class TextDisplay(Item[V]): """Represents a UI text display. - This is a top-level layout component that can only be used on :class:`LayoutView` or :class:`Section`. + This is a top-level layout component that can only be used on :class:`LayoutView`, + :class:`Section`, :class:`Container`, or :class:`Modal`. .. versionadded:: 2.6 diff --git a/discord/ui/text_input.py b/discord/ui/text_input.py index de0c8e079..0647b29cf 100644 --- a/discord/ui/text_input.py +++ b/discord/ui/text_input.py @@ -53,6 +53,8 @@ V = TypeVar('V', bound='BaseView', covariant=True) class TextInput(Item[V]): """Represents a UI text input. + This a top-level layout component that can only be used in :class:`Label`. + .. container:: operations .. describe:: str(x)