skeleton.py 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. """Container to stack elements with spacing."""
  2. from typing import Optional
  3. from reflex.components.chakra import ChakraComponent
  4. from reflex.vars import Var
  5. class Skeleton(ChakraComponent):
  6. """Skeleton is used to display the loading state of some components. You can use it as a standalone component. Or to wrap another component to take the same height and width."""
  7. tag = "Skeleton"
  8. # The color at the animation end
  9. end_color: Optional[Var[str]] = None
  10. # The fadeIn duration in seconds
  11. fade_duration: Optional[Var[float]] = None
  12. # If true, it'll render its children with a nice fade transition
  13. is_loaded: Optional[Var[bool]] = None
  14. # The animation speed in seconds
  15. speed: Optional[Var[float]] = None
  16. # The color at the animation start
  17. start_color: Optional[Var[str]] = None
  18. class SkeletonCircle(ChakraComponent):
  19. """SkeletonCircle is used to display the loading state of some components."""
  20. tag = "SkeletonCircle"
  21. # The color at the animation end
  22. end_color: Optional[Var[str]] = None
  23. # The fadeIn duration in seconds
  24. fade_duration: Optional[Var[float]] = None
  25. # If true, it'll render its children with a nice fade transition
  26. is_loaded: Optional[Var[bool]] = None
  27. # The animation speed in seconds
  28. speed: Optional[Var[float]] = None
  29. # The color at the animation start
  30. start_color: Optional[Var[str]] = None
  31. class SkeletonText(ChakraComponent):
  32. """SkeletonText is used to display the loading state of some components."""
  33. tag = "SkeletonText"
  34. # The color at the animation end
  35. end_color: Optional[Var[str]] = None
  36. # The fadeIn duration in seconds
  37. fade_duration: Optional[Var[float]] = None
  38. # If true, it'll render its children with a nice fade transition
  39. is_loaded: Optional[Var[bool]] = None
  40. # The animation speed in seconds
  41. speed: Optional[Var[float]] = None
  42. # The color at the animation start
  43. start_color: Optional[Var[str]] = None
  44. # Number is lines of text.
  45. no_of_lines: Optional[Var[int]] = None