Grid / Layout Grid - 图1

Grid React Component

Grid React component represents Framework7’s Layout Grid.

Grid Components

There are following components included:

  • **Row** / **F7Row** - grid row
  • **Col** / **F7Col** - grid column (cell)

Grid Properties

PropTypeDefaultDescription
<Row> properties
noGapbooleanfalseRemoves spacing between columns
tagstringdivDefines which tag must be used to render row element
<Col> properties
widthnumber
string
autoColumn width. Check available Column Sizes
tabletWidthnumber
string
Column width for large screen tablets (when width >= 768px)
desktopWidthnumber
string
Column width for larger screen tablets (when width >= 1025px)

Examples

  1. <Block>
  2. <p>Columns within a row are automatically set to have equal width. Otherwise you can define your column with pourcentage of screen you want.</p>
  3. </Block>
  4. <BlockTitle>Columns with gap</BlockTitle>
  5. <Block>
  6. <Row>
  7. <Col>50% (.col)</Col>
  8. <Col>50% (.col)</Col>
  9. </Row>
  10. <Row>
  11. <Col>25% (.col)</Col>
  12. <Col>25% (.col)</Col>
  13. <Col>25% (.col)</Col>
  14. <Col>25% (.col)</Col>
  15. </Row>
  16. <Row>
  17. <Col>33% (.col)</Col>
  18. <Col>33% (.col)</Col>
  19. <Col>33% (.col)</Col>
  20. </Row>
  21. <Row>
  22. <Col>20% (.col)</Col>
  23. <Col>20% (.col)</Col>
  24. <Col>20% (.col)</Col>
  25. <Col>20% (.col)</Col>
  26. <Col>20% (.col)</Col>
  27. </Row>
  28. <Row>
  29. <Col width="33">33% (.col-33)</Col>
  30. <Col width="66">66% (.col-66)</Col>
  31. </Row>
  32. <Row>
  33. <Col width="25">25% (.col-25)</Col>
  34. <Col width="25">25% (.col-25)</Col>
  35. <Col width="50">50% (.col-50)</Col>
  36. </Row>
  37. <Row>
  38. <Col width="75">75% (.col-75)</Col>
  39. <Col width="25">25% (.col-25)</Col>
  40. </Row>
  41. <Row>
  42. <Col width="80">80% (.col-80)</Col>
  43. <Col width="20">20% (.col-20)</Col>
  44. </Row>
  45. </Block>
  46. <BlockTitle>No gap between columns</BlockTitle>
  47. <Block>
  48. <Row noGap>
  49. <Col>50% (.col)</Col>
  50. <Col>50% (.col)</Col>
  51. </Row>
  52. <Row noGap>
  53. <Col>25% (.col)</Col>
  54. <Col>25% (.col)</Col>
  55. <Col>25% (.col)</Col>
  56. <Col>25% (.col)</Col>
  57. </Row>
  58. <Row noGap>
  59. <Col>33% (.col)</Col>
  60. <Col>33% (.col)</Col>
  61. <Col>33% (.col)</Col>
  62. </Row>
  63. <Row noGap>
  64. <Col>20% (.col)</Col>
  65. <Col>20% (.col)</Col>
  66. <Col>20% (.col)</Col>
  67. <Col>20% (.col)</Col>
  68. <Col>20% (.col)</Col>
  69. </Row>
  70. <Row noGap>
  71. <Col width="33">33% (.col-33)</Col>
  72. <Col width="66">66% (.col-66)</Col>
  73. </Row>
  74. <Row noGap>
  75. <Col width="25">25% (.col-25)</Col>
  76. <Col width="25">25% (.col-25)</Col>
  77. <Col width="50">50% (.col-50)</Col>
  78. </Row>
  79. <Row noGap>
  80. <Col width="75">75% (.col-75)</Col>
  81. <Col width="25">25% (.col-25)</Col>
  82. </Row>
  83. <Row noGap>
  84. <Col width="80">80% (.col-80)</Col>
  85. <Col width="20">20% (.col-20)</Col>
  86. </Row>
  87. </Block>
  88. <BlockTitle>Nested</BlockTitle>
  89. <Block>
  90. <Row>
  91. <Col>50% (.col)
  92. <Row>
  93. <Col>50% (.col)</Col>
  94. <Col>50% (.col)</Col>
  95. </Row>
  96. </Col>
  97. <Col>50% (.col)
  98. <Row>
  99. <Col width="33">33% (.col-33)</Col>
  100. <Col width="66">66% (.col-66)</Col>
  101. </Row>
  102. </Col>
  103. </Row>
  104. </Block>
  105. <BlockTitle>Responsive Grid</BlockTitle>
  106. <Block>
  107. <p>Grid cells have different size on Phone/Tablet</p>
  108. <Row>
  109. <Col width="100" tabletWidth="50">.col-100.tablet-50</Col>
  110. <Col width="100" tabletWidth="50">.col-100.tablet-50</Col>
  111. </Row>
  112. <Row>
  113. <Col width="50" tabletWidth="25">.col-50.tablet-25</Col>
  114. <Col width="50" tabletWidth="25">.col-50.tablet-25</Col>
  115. <Col width="50" tabletWidth="25">.col-50.tablet-25</Col>
  116. <Col width="50" tabletWidth="25">.col-50.tablet-25</Col>
  117. </Row>
  118. <Row>
  119. <Col width="100" tabletWidth="40">.col-100.tablet-40</Col>
  120. <Col width="50" tabletWidth="60">.col-50.tablet-60</Col>
  121. <Col width="50" tabletWidth="66">.col-50.tablet-66</Col>
  122. <Col width="100" tabletWidth="33">.col-100.tablet-33</Col>
  123. </Row>
  124. </Block>