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
resizablebooleanfalseMakes row resizable
resizableAbsolutebooleanfalseEnables absolute resizing (in px)
resizableFixedbooleanfalseKeeps resizable row in fixed size (not resizable)
resizableHhandlerbooleantrueAdds resize handler element (between rows) to resize them
<Col> properties
widthnumber
string
autoColumn width. Check available Column Sizes
xsmallnumberColumn width when app width >= 480px
smallnumberColumn width when app width >= 568px
mediumnumberColumn width when app width >= 768px
largenumberColumn width when app width >= 1024px
xlargenumberColumn width when app width >= 1200px
resizablebooleanfalseMakes column resizable
resizableAbsolutebooleanfalseEnables absolute resizing (in px)
resizableFixedbooleanfalseKeeps resizable column in fixed size (not resizable)
resizableHandlerbooleantrueAdds resize handler element (between columns) to resize them

Grid Events

EventDescription
<Row> events
gridResizeEvent will be triggered on resizable grid row resize
<Col> events
gridResizeEvent will be triggered on resizable grid column resize

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" medium="50">.col-100.tablet-50</Col>
  110. <Col width="100" medium="50">.col-100.tablet-50</Col>
  111. </Row>
  112. <Row>
  113. <Col width="50" medium="25">.col-50.tablet-25</Col>
  114. <Col width="50" medium="25">.col-50.tablet-25</Col>
  115. <Col width="50" medium="25">.col-50.tablet-25</Col>
  116. <Col width="50" medium="25">.col-50.tablet-25</Col>
  117. </Row>
  118. <Row>
  119. <Col width="100" medium="40">.col-100.tablet-40</Col>
  120. <Col width="50" medium="60">.col-50.tablet-60</Col>
  121. <Col width="50" medium="66">.col-50.tablet-66</Col>
  122. <Col width="100" medium="33">.col-100.tablet-33</Col>
  123. </Row>
  124. </Block>
  125. <BlockTitle>Resizable Cols</BlockTitle>
  126. <Block className="grid-resizable-demo">
  127. <Row>
  128. <Col resizable style={{minWidth: '20px'}}>1</Col>
  129. <Col resizable style={{minWidth: '20px'}}>2</Col>
  130. <Col resizable style={{minWidth: '20px'}}>3</Col>
  131. </Row>
  132. </Block>
  133. <BlockTitle>Resizable Fixed Col</BlockTitle>
  134. <BlockHeader>2nd column has fixed size</BlockHeader>
  135. <Block className="grid-resizable-demo">
  136. <Row>
  137. <Col resizable style={{minWidth: '20px'}}>1</Col>
  138. <Col resizable resizableFixed style={{minWidth: '20px'}}>2</Col>
  139. <Col resizable style={{minWidth: '20px'}}>3</Col>
  140. </Row>
  141. </Block>
  142. <BlockTitle>Resizable Grid</BlockTitle>
  143. <Block className="grid-resizable-demo">
  144. <Row className="align-items-stretch" style={{height: '300px'}}>
  145. <Col resizable className="demo-col-center-content" style={{minWidth: '50px'}}>Left</Col>
  146. <Col resizable className="display-flex flex-direction-column" style={{
  147. padding: '0px',
  148. border: 'none',
  149. minWidth: '50px',
  150. backgroundColor: 'transparent',
  151. }}>
  152. <Row resizable style={{height: '50%', minHeight: '50px'}}>
  153. <Col className="demo-col-center-content" style={{height: '100%'}}>Center Top</Col>
  154. </Row>
  155. <Row resizable style={{height: '50%', minHeight: '50px'}}>
  156. <Col className="demo-col-center-content" style={{height: '100%'}}>Center Bottom</Col>
  157. </Row>
  158. </Col>
  159. <Col resizable className="demo-col-center-content" style={{minWidth: '50px'}}>Right</Col>
  160. </Row>
  161. </Block>

← Gauge

Icon →