@@ -128,35 +128,51 @@ class Modal(BaseModel):
128128
129129 Attributes
130130 ----------
131- component_id: Unique identifier for this modal (auto-generated if not provided)
132- title: Modal header title
133- items: List of input items (Button, Select, TextInput, Div, etc.)
134- size: Preset size ("sm", "md", "lg", "xl", "full")
135- width: Custom width override (e.g., "600px")
136- max_height: Maximum height before scrolling (default: "80vh")
137- overlay_opacity: Background overlay opacity 0.0-1.0 (default: 0.5)
138- close_on_escape: Close when Escape key pressed (default: True)
139- close_on_overlay_click: Close when clicking outside modal (default: True)
140- reset_on_close: Reset form inputs when closed (default: True)
141- on_close_event: Custom event name to emit when modal closes
142- open_on_load: Whether modal starts open (default: False)
143- style: Inline CSS for the modal container
144- script: JS file path or inline string to inject
145- class_name: Custom CSS class for the modal container
146-
147- Example:
148- Modal(
149- title="User Settings",
150- size="md",
151- class_name="settings-modal",
152- items=[
153- TextInput(label="Username", event="user:name"),
154- Toggle(label="Notifications", event="user:notifications"),
155- Button(label="Save", event="user:save", variant="primary"),
156- ],
157- reset_on_close=False, # Preserve values between opens
158- on_close_event="settings:closed",
159- )
131+ component_id : str
132+ Unique identifier for this modal (auto-generated if not provided).
133+ title : str
134+ Modal header title.
135+ items : list
136+ List of input items (Button, Select, TextInput, Div, etc.).
137+ size : str
138+ Preset size (``"sm"``, ``"md"``, ``"lg"``, ``"xl"``, ``"full"``).
139+ width : str
140+ Custom width override (e.g., ``"600px"``).
141+ max_height : str
142+ Maximum height before scrolling (default: ``"80vh"``).
143+ overlay_opacity : float
144+ Background overlay opacity 0.0–1.0 (default: 0.5).
145+ close_on_escape : bool
146+ Close when Escape key pressed (default: True).
147+ close_on_overlay_click : bool
148+ Close when clicking outside modal (default: True).
149+ reset_on_close : bool
150+ Reset form inputs when closed (default: True).
151+ on_close_event : str
152+ Custom event name to emit when modal closes.
153+ open_on_load : bool
154+ Whether modal starts open (default: False).
155+ style : str
156+ Inline CSS for the modal container.
157+ script : str
158+ JS file path or inline string to inject.
159+ class_name : str
160+ Custom CSS class for the modal container.
161+
162+ Examples
163+ --------
164+ >>> Modal(
165+ ... title="User Settings",
166+ ... size="md",
167+ ... class_name="settings-modal",
168+ ... items=[
169+ ... TextInput(label="Username", event="user:name"),
170+ ... Toggle(label="Notifications", event="user:notifications"),
171+ ... Button(label="Save", event="user:save", variant="primary"),
172+ ... ],
173+ ... reset_on_close=False,
174+ ... on_close_event="settings:closed",
175+ ... )
160176 """
161177
162178 model_config = ConfigDict (
0 commit comments