Avatar
Display an avatar with the user's picture or a default icon.
@solara.component
def Avatar(image_url: Optional[str] = None, size: Union[int, str] = 40, color: str = "primary"):
...
Example
import solara
from solara_enterprise import auth
@solara.component
def Page():
if not auth.user.value:
solara.Info("Login to see your avatar")
solara.Button("Login", icon_name="mdi-login", href=auth.get_login_url())
else:
auth.Avatar() # this shows the user's picture
solara.Button("Logout", icon_name="mdi-logout", href=auth.get_logout_url())
Login to see your avatar
Live output
Arguments
- image_url: if not given, the picture from the user's profile will be used (OAuth only)
- size: size of the avatar (in pixels)
- color: color of the avatar (if no picture is available)