logoalt Hacker News

bicxlast Monday at 10:34 PM1 replyview on HN

I like toasts as a non-obtrusive confirmation of an action, but not as a method to present important information.


Replies

btownlast Monday at 10:49 PM

Among the various potential uses of a toast, IMO:

- quick, in response to a clicked button -> why not just show feedback on the button?

- quick, in response to a keyboard shortcut -> ok

- seconds or more after an action, say, if your import/export is done -> fine, but have a more persistent notifications inbox or send the user an email too, because if you dismiss the toast, how do you get back to that result?

- when you've just navigated to a page, as a way to present an alert or advisory about the new page -> if it's important enough, why not show it as a persistent alert on the page itself?

Far too many toasts are used for the last use case. Part of the reason for this, I think, is because if you detect something weird in a React callback, you'd need to wire up a whole new state variable to show it, vs. just calling a global toast() function at the time where you learn about the weird thing. But is it really much more work than toasting to roll something like const {alertElement, addAlert} = useAlerts()? And have it speak your design language?

Your 50-tabs-open multitasking users will appreciate you.

show 2 replies