@@ -354,61 +354,52 @@ def form(
354
354
) -> form_plugin [S , T ]:
355
355
"""Create a submittable form out of this `UIElement`.
356
356
357
- Use this method to create a form that gates the submission
358
- of a `UIElement`s value until a submit button is clicked.
359
-
360
- The value of the `form` is the value of the underlying
361
- element the last time the form was submitted.
362
-
363
- **Examples.**
364
-
365
- Convert any `UIElement` into a form:
366
-
367
- ```python
368
- prompt = mo.ui.text_area().form()
369
- ```
370
-
371
- Combine with `HTML.batch` to create a form made out of multiple
372
- `UIElements`:
373
-
374
- ```python
375
- form = (
376
- mo.ui.md(
377
- '''
378
- **Enter your prompt.**
379
-
380
- {prompt}
381
-
382
- **Choose a random seed.**
357
+ Creates a form that gates submission of a `UIElement`'s value until a submit button is clicked.
358
+ The form's value is the value of the underlying element from the last submission.
359
+
360
+ Examples:
361
+ Convert any `UIElement` into a form:
362
+ ```python
363
+ prompt = mo.ui.text_area().form()
364
+ ```
365
+
366
+ Combine with `HTML.batch` to create a form made out of multiple `UIElements`:
367
+ ```python
368
+ form = (
369
+ mo.ui.md(
370
+ '''
371
+ **Enter your prompt.**
372
+
373
+ {prompt}
374
+
375
+ **Choose a random seed.**
376
+
377
+ {seed}
378
+ '''
379
+ )
380
+ .batch(
381
+ prompt=mo.ui.text_area(),
382
+ seed=mo.ui.number(),
383
+ )
384
+ .form()
385
+ )
386
+ ```
383
387
384
- {seed}
385
- '''
386
- )
387
- .batch(
388
- prompt=mo.ui.text_area(),
389
- seed=mo.ui.number(),
390
- )
391
- .form()
392
- )
393
- ```
394
-
395
- **Args.**
396
-
397
- - `label`: A text label for the form.
398
- - `bordered`: whether the form should have a border
399
- - `loading`: whether the form should be in a loading state
400
- - `submit_button_label`: the label of the submit button
401
- - `submit_button_tooltip`: the tooltip of the submit button
402
- - `submit_button_disabled`: whether the submit button should be
403
- disabled
404
- - `clear_on_submit`: whether the form should clear its contents after
405
- submitting
406
- - `show_clear_button`: whether the form should show a clear button
407
- - `clear_button_label`: the label of the clear button
408
- - `clear_button_tooltip`: the tooltip of the clear button
409
- - `validate`: a function that takes the form's value and returns an
410
- error message if the value is invalid,
411
- or `None` if the value is valid
388
+ Args:
389
+ label: A text label for the form.
390
+ bordered: Whether the form should have a border.
391
+ loading: Whether the form should be in a loading state.
392
+ submit_button_label: The label of the submit button.
393
+ submit_button_tooltip: The tooltip of the submit button.
394
+ submit_button_disabled: Whether the submit button should be disabled.
395
+ clear_on_submit: Whether the form should clear its contents after submitting.
396
+ show_clear_button: Whether the form should show a clear button.
397
+ clear_button_label: The label of the clear button.
398
+ clear_button_tooltip: The tooltip of the clear button.
399
+ validate: A function that takes the form's value and returns an error message if invalid,
400
+ or `None` if valid.
401
+ on_change: A callback that takes the form's value and returns an error message if invalid,
402
+ or `None` if valid.
412
403
"""
413
404
from marimo ._plugins .ui ._impl .input import form as form_plugin
414
405
0 commit comments