stack.py 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. """Container to stack elements with spacing."""
  2. from typing import List, Union
  3. from reflex.components.libs.chakra import ChakraComponent, LiteralStackDirection
  4. from reflex.vars import Var
  5. class Stack(ChakraComponent):
  6. """Container to stack elements with spacing."""
  7. tag = "Stack"
  8. # Shorthand for alignItems style prop
  9. align_items: Var[str]
  10. # The direction to stack the items.
  11. direction: Var[Union[LiteralStackDirection, List[str]]]
  12. # If true the items will be stacked horizontally.
  13. is_inline: Var[bool]
  14. # Shorthand for justifyContent style prop
  15. justify_content: Var[str]
  16. # If true, the children will be wrapped in a Box, and the Box will take the spacing props
  17. should_wrap_children: Var[bool]
  18. # The space between each stack item
  19. spacing: Var[str]
  20. # Shorthand for flexWrap style prop
  21. wrap: Var[str]
  22. # Alignment of contents.
  23. justify: Var[str]
  24. class Hstack(Stack):
  25. """Stack items horizontally."""
  26. tag = "HStack"
  27. class Vstack(Stack):
  28. """Stack items vertically."""
  29. tag = "VStack"