What UI component should I use to display API error or backend error? Any best practice and what kind of UI element can I use to display it. I don't want to display it inside a form, but a sort of general way to display it. What are some best practices?

The error are general error like:

Connection to the database cannot be made Category already exist You don't have permission Your token has expired. Please login again.

  • 1
    It depends on the context where it appears and the effects that the error has.
    – Nash
    Oct 19 at 7:05

1 Answer 1


Any error alert should offer the user a way to resolve the problem.

This resolution could be something simple like trying again later or something complex involving settings or syntax but the response to the error should always send the user in the right direction to fix the problem as quickly and easily as possible.

Having said that, it's not the users' responsibility to fix your database issues and there may be a bigger problem beyond the users' control - In these cases, the resolution is to point the user to somewhere they can report the fault.

When it comes to visibility, this depends on the severity of the error from the users' point of view. One of your server warehouses could be on fire but that doesn't matter to the users. On the other hand, a user could have entered an illegal character into a field that will make their system choke - this is extremely critical to the users.

The more critical the error (from the users' perspective) the more visible the alert should be. "Server access times are a little slow right now" could be a little notification in the corner of the window whereas "Your next click will delete all your records" needs to be a big dialogue sanity check in the front of the window blocking the user from doing anything until a response has been made.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.