Navbar user profile component

Navbar profile components are extremely common (there is even on on this forum!). They are also a little annoying to build because, generally, you want to render placeholders when no image is available.

We can’t seem to find a prebuilt component for this in weweb. How do weweb users typically handle this?

I think normally this would be done on the backend. So when a user is created, you would have a default placeholder image that you set to populate the database. That is only overwritten if and when they upload an image.

Hey,
you can also add your logic in front end easily.
You can use a formula for binding your image url, and if the url is not exisiting, use a default one.
You can even do custom one with color and image.

  • Put a conditional rendering on your image, depending if the url exist or not
  • Put a conditional rendering on an image with the opposite condition. Set the text content to the first letter of the user, and use a hash of their name to generate a color (so this will always be the same).
2 Likes