MCPcopy
hub / github.com/StructuredLabs/preswald / checkbox_demo

Function checkbox_demo

preswald/tutorial/hello.py:400–436  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

398
399@workflow.atom()
400def checkbox_demo():
401 text("## 12. Adding Interactivity with `checkbox()`")
402 text(
403 "The `checkbox()` function allows users to select or deselect an option using a checkbox."
404 )
405
406 # Simple checkbox example
407 is_selected = checkbox(label="Select me!")
408
409 # Show the checkbox state
410 if is_selected:
411 text("✅ Checkbox is selected!")
412 else:
413 text("⬜ Checkbox is not selected")
414
415 text(
416 """
417The `checkbox()` component creates an interactive checkbox input.
418**Example:**
419```python
420from preswald import checkbox
421
422# Basic usage
423is_checked = checkbox(
424 label="Enable feature",
425 default=False
426)
427
428# Use the checkbox value in your app
429if is_checked:
430 # Do something when checked
431 print("Feature enabled!")
432```
433
434The checkbox returns a boolean value that you can use to control your app's behavior.
435"""
436 )
437
438
439@workflow.atom()

Callers

nothing calls this directly

Calls 2

textFunction · 0.90
checkboxFunction · 0.90

Tested by

no test coverage detected