avatar.py 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. """Interactive components provided by @radix-ui/themes."""
  2. from typing import Literal
  3. from reflex.components.core.breakpoints import Responsive
  4. from reflex.vars.base import Var
  5. from ..base import LiteralAccentColor, LiteralRadius, RadixThemesComponent
  6. LiteralSize = Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]
  7. class Avatar(RadixThemesComponent):
  8. """An image element with a fallback for representing the user."""
  9. tag = "Avatar"
  10. # The variant of the avatar
  11. variant: Var[Literal["solid", "soft"]]
  12. # The size of the avatar: "1" - "9"
  13. size: Var[Responsive[LiteralSize]]
  14. # Color theme of the avatar
  15. color_scheme: Var[LiteralAccentColor]
  16. # Whether to render the avatar with higher contrast color against background
  17. high_contrast: Var[bool]
  18. # Override theme radius for avatar: "none" | "small" | "medium" | "large" | "full"
  19. radius: Var[LiteralRadius]
  20. # The src of the avatar image
  21. src: Var[str]
  22. # The rendered fallback text
  23. fallback: Var[str]
  24. avatar = Avatar.create