stack.py 1.2 KB

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