grid.py 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. """Container to stack elements with spacing."""
  2. from typing import List
  3. from pynecone.components.libs.chakra import ChakraComponent
  4. from pynecone.var import Var
  5. class Grid(ChakraComponent):
  6. """A grid component."""
  7. tag = "Grid"
  8. # Shorthand prop for gridAutoColumns
  9. auto_columns: Var[str]
  10. # Shorthand prop for gridAutoFlow
  11. auto_flow: Var[str]
  12. # Shorthand prop for gridAutoRows
  13. auto_rows: Var[str]
  14. # Shorthand prop for gridColumn
  15. column: Var[str]
  16. # Shorthand prop for gridRow
  17. row: Var[str]
  18. # Shorthand prop for gridTemplateColumns
  19. template_columns: Var[str]
  20. # Shorthand prop for gridTemplateRows
  21. template_rows: Var[str]
  22. class GridItem(ChakraComponent):
  23. """Used as a child of Grid to control the span, and start positions within the grid."""
  24. tag = "GridItem"
  25. # Shorthand prop for gridArea
  26. area: Var[str]
  27. # Shorthand prop for gridColumnEnd
  28. col_end: Var[str]
  29. # The column number the grid item should start.
  30. col_start: Var[int]
  31. # The number of columns the grid item should span.
  32. col_span: Var[int]
  33. # Shorthand prop for gridRowEnd
  34. row_end: Var[str]
  35. # The row number the grid item should start.
  36. row_start: Var[int]
  37. # The number of rows the grid item should span.
  38. row_span: Var[int]
  39. class ResponsiveGrid(ChakraComponent):
  40. """A responsive grid component."""
  41. tag = "SimpleGrid"
  42. # Shorthand prop for gridAutoColumns
  43. auto_columns: Var[str]
  44. # Shorthand prop for gridAutoFlow
  45. auto_flow: Var[str]
  46. # Shorthand prop for gridAutoRows
  47. auto_rows: Var[str]
  48. # Shorthand prop for gridColumn
  49. column: Var[str]
  50. # Shorthand prop for gridRow
  51. row: Var[str]
  52. # A list that defines the number of columns for each breakpoint.
  53. columns: Var[List[int]]
  54. # The width at which child elements will break into columns. Pass a number for pixel values or a string for any other valid CSS length.
  55. min_child_width: Var[str]
  56. # The gap between the grid items
  57. spacing: Var[str]
  58. # The column gap between the grid items
  59. spacing_x: Var[str]
  60. # The row gap between the grid items
  61. spacing_y: Var[str]
  62. # Shorthand prop for gridTemplateAreas
  63. template_areas: Var[str]
  64. # Shorthand prop for gridTemplateColumns
  65. template_columns: Var[str]
  66. # Shorthand prop for gridTemplateRows
  67. template_rows: Var[str]