Skip to content

Commit 6937df6

Browse files
authored
docs: add detailed docstrings to properties of Item (#2683)
Enhance Item Class with Detailed Docstrings for Properties and Methods. Signed-off-by: Error44 <[email protected]>
1 parent b4b2bdb commit 6937df6

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

discord/ui/item.py

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,22 @@ def __repr__(self) -> str:
9797

9898
@property
9999
def row(self) -> int | None:
100+
"""Gets or sets the row position of this item within its parent view.
101+
102+
The row position determines the vertical placement of the item in the UI.
103+
The value must be an integer between 0 and 4 (inclusive), or ``None`` to indicate
104+
that no specific row is set.
105+
106+
Returns
107+
-------
108+
Optional[:class:`int`]
109+
The row position of the item, or ``None`` if not explicitly set.
110+
111+
Raises
112+
------
113+
ValueError
114+
If the row value is not ``None`` and is outside the range [0, 4].
115+
"""
100116
return self._row
101117

102118
@row.setter
@@ -110,11 +126,29 @@ def row(self, value: int | None):
110126

111127
@property
112128
def width(self) -> int:
129+
"""Gets the width of the item in the UI layout.
130+
131+
The width determines how much horizontal space this item occupies within its row.
132+
133+
Returns
134+
-------
135+
:class:`int`
136+
The width of the item. Defaults to 1.
137+
"""
113138
return 1
114139

115140
@property
116141
def view(self) -> V | None:
117-
"""The underlying view for this item."""
142+
"""Gets the parent view associated with this item.
143+
144+
The view refers to the container that holds this item. This is typically set
145+
automatically when the item is added to a view.
146+
147+
Returns
148+
-------
149+
Optional[:class:`View`]
150+
The parent view of this item, or ``None`` if the item is not attached to any view.
151+
"""
118152
return self._view
119153

120154
async def callback(self, interaction: Interaction):

0 commit comments

Comments
 (0)