Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP]Form High Level API #3039

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

ElijahAhianyo
Copy link
Collaborator

@ElijahAhianyo ElijahAhianyo commented Apr 8, 2024

import reflex as rx

def index() -> rx.Component:
    return rx.center(
       form := rx.form(
            rx.vstack(
                rx.input(
                    placeholder="First Name",
                    name="first_name",
                ),
                rx.input(
                    placeholder="Last Name",
                    name="last_name",
                ),
                rx.hstack(
                    rx.checkbox("Checked", name="check"),
                    rx.switch("Switched", name="switch"),
                ),
            ),
        ),


        rx.divider(),
        rx.heading("Results"),
        rx.text(form.State.form_data.to_string()),
    )


app = rx.App()
app.add_page(index)

The above should implicitly create a submit event handler and a submit button if not specified

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant