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

[REF-2647] Toast Reflex component! (Sonner) #2981

Closed
ema11412 opened this issue Apr 2, 2024 · 4 comments
Closed

[REF-2647] Toast Reflex component! (Sonner) #2981

ema11412 opened this issue Apr 2, 2024 · 4 comments
Labels
Milestone

Comments

@ema11412
Copy link

ema11412 commented Apr 2, 2024

The creation of a Toast in reflex would be very useful.

for example

def toast() -> rx.Component:
    """The toast component."""
    return rx.toast(
        tile="Hello, world!",
        status="success",
        duration=5000,
        is_open=State.toast_open,
        position="top-right",
        onClose=State.close_toast,
    )

Ref:

PR : #3186

From SyncLinear.com | REF-2647

@carlosabadia
Copy link
Contributor

I also suggest Sonner :)

@masenf
Copy link
Collaborator

masenf commented Apr 11, 2024

i think rather than having the toast declarative, we would probably implement it as an event that you could return from a backend event handler or in response to an event trigger.

rx.button(
    "Toast 🍸",
    on_click=rx.toast(
        tile="Hello, world!",
        status="success",
        duration=5000,
        position="top-right",
        onClose=State.close_toast,
    )
)

@picklelo
Copy link
Contributor

@masenf Agreed, it serves a similar functionality to rx.window_alert

@Lendemor
Copy link
Collaborator

Lendemor commented Apr 12, 2024

I also suggest Sonner :)

Chance are high that we will go with the one from Radix since this it the lib we use as our core one.

Feel free to try wrapping the Sonner one as a 3rd party component if you want to. (https://reflex.dev/docs/custom-components/overview/)

@picklelo picklelo added the linear Created by Linear-GitHub Sync label Apr 23, 2024
@picklelo picklelo changed the title Toast Reflex component! [REF-2647] Toast Reflex component! Apr 23, 2024
@picklelo picklelo changed the title [REF-2647] Toast Reflex component! [REF-2647] Toast Reflex component! (Sonner) Apr 25, 2024
@picklelo picklelo closed this as completed May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants