←back to thread

123 points samsolomon | 1 comments | | HN request time: 0s | source
Show context
bicx ◴[] No.46198573[source]
I like toasts as a non-obtrusive confirmation of an action, but not as a method to present important information.
replies(1): >>46198739 #
btown ◴[] No.46198739[source]
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.

replies(2): >>46200133 #>>46201803 #
1. setr ◴[] No.46201803[source]
I always just used it to confirm your last action on a POST —> GET sequence. Eg confirming that your save went through/rejected (the error itself embedded & persisted in the actual page). Or especially if saving doesn’t trigger a refresh so success would be otherwise silent (and thus indistinguishable from failing to click).

You could have the button do some fancy transformation into a save button but I prefer the core page being relatively static (and I really don’t like buttons having state).

It’s the only reasonable scenario for toasts that I can think of though.