Added TestableCheckbox
This commit is contained in:
26
src/myfasthtml/docs/clickme.py
Normal file
26
src/myfasthtml/docs/clickme.py
Normal file
@@ -0,0 +1,26 @@
|
||||
from fasthtml import serve
|
||||
|
||||
from myfasthtml.controls.helpers import mk
|
||||
from myfasthtml.core.commands import Command
|
||||
from myfasthtml.myfastapp import create_app
|
||||
|
||||
|
||||
# Define a simple command action
|
||||
def say_hello():
|
||||
return "Hello, FastHtml!"
|
||||
|
||||
|
||||
# Create the command
|
||||
hello_command = Command("say_hello", "Responds with a greeting", say_hello)
|
||||
|
||||
# Create the app
|
||||
app, rt = create_app(protect_routes=False)
|
||||
|
||||
|
||||
@rt("/")
|
||||
def get_homepage():
|
||||
return mk.button("Click Me!", command=hello_command)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
serve(port=5002)
|
||||
Reference in New Issue
Block a user