How do I conditionally show a toast? #3858
agardnerIT
announced in
Q&A
Replies: 2 comments
-
Did you find a solution? I am having the same issue. |
Beta Was this translation helpful? Give feedback.
0 replies
-
probably what you would want to do here is class MyState(rx.State):
def handle_submit(self, form_data):
# ... do form processing stuff
return rx.toast.success("You submitted the form, congrats")
...
def index():
return rx.form(
...,
on_submit=MyState.handle_submit,
) In this case you display the toast imperatively when your event handler is done processing the form data. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Brand new to reflex (looks fantastic btw!) so forgive me if this is obvious, but I'm missing something.
I want to conditionally show a toast if a boolean is
True
First, the docs state:
The second component is optional and can be omitted. If it is omitted, nothing is rendered if the condition is False.
but with the above, I get:So I add a dummy
text
field to keep it happy:and now get:
Reflex Version
Beta Was this translation helpful? Give feedback.
All reactions