Cards - 图1

Card React Component

Cards, along with List View, is a one more great way to contain and orginize your information. Cards contains unique related data, for example, a photo, text, and link all about a single subject. Cards are typically an entry point to more complex and detailed information.

Card React component represents Cards component.

Card Components

There are following components included:

  • **Card** / **F7Card**
  • **CardHeader** / **F7CardHeader**
  • **CardContent** / **F7CardContent**
  • **CardFooter** / **F7CardFooter**

Card Properties

PropTypeDefaultDescription
<Card> properties
titlestringCard header content
contentstringCard content
footerstringCard footer content
paddingbooleantrueAdds additional inner padding on card content
outlinebooleanfalseMakes Card outline
noShadowbooleanfalseDisables card shadow
noBorderbooleanfalseDisables card border (for outline cards)
expandablebooleanfalseEnables expandable card
expandableAnimateWidthbooleanfalseEnables card content width also animatable and responsive, but can affect performance
expandableOpenedbooleanfalseBoolean property indicating whether the expandable card opened or not
animatebooleantrueSpecifies to open expandable card with animation or not
hideNavbarOnOpenbooleanWill hide Navbar on expandable card open. By default inherits same app card parameter.
hideToolbarOnOpenbooleanWill hide Toolbar on expandable card open. By default inherits same app card parameter.
swipeToClosebooleanAllows to close expandable card with swipe. By default inherits same app card parameter.
backdropbooleanEnables expandable card backdrop layer. By default inherits same app card parameter.
backdropElstringAllows to specify custom expandable card backdrop element. This should be a CSS selector of backdrop element, e.g. .card-backdrop.custom-backdrop
closeByBackdropClickbooleanWhen enabled, expandable card will be closed on its backdrop click. By default inherits same app card parameter.
<f7-card-content> properties
paddingbooleantrueAdds additional inner padding
<CardContent> properties
paddingbooleantrueAdds additional inner padding

Card Events

EventDescription
<Card> events
cardBeforeOpenEvent will be triggered right before expandable card starts its opening animation. event.detail.prevent contains function that will prevent card from opening when called
cardOpenEvent will be triggered when expandable card starts its opening animation
cardOpenedEvent will be triggered after expandable card completes its opening animation
cardCloseEvent will be triggered when expandable card starts its closing animation
cardClosedEvent will be triggered after expandable card completes its closing animation

Examples

  1. <BlockTitle>Simple Cards</BlockTitle>
  2. <Card
  3. content="This is a simple card with plain text, but cards can also contain their own header, footer, list view, image, or any other element."
  4. ></Card>
  5. <Card
  6. title="Card header"
  7. content="Card with header and footer. Card headers are used to display card titles and footers for additional information or just for custom actions."
  8. footer="Card footer"
  9. ></Card>
  10. <Card
  11. content="Another card. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse feugiat sem est, non tincidunt ligula volutpat sit amet. Mauris aliquet magna justo. "
  12. ></Card>
  13. <BlockTitle>Outline Cards</BlockTitle>
  14. <Card
  15. outline
  16. content="This is a simple card with plain text, but cards can also contain their own header, footer, list view, image, or any other element."
  17. ></Card>
  18. <Card
  19. outline
  20. title="Card header"
  21. content="Card with header and footer. Card headers are used to display card titles and footers for additional information or just for custom actions."
  22. footer="Card footer"
  23. ></Card>
  24. <Card
  25. outline
  26. content="Another card. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse feugiat sem est, non tincidunt ligula volutpat sit amet. Mauris aliquet magna justo. "
  27. ></Card>
  28. <BlockTitle>Styled Cards</BlockTitle>
  29. <Card className="demo-card-header-pic">
  30. <CardHeader
  31. className="no-border"
  32. valign="bottom"
  33. style={{ backgroundImage: 'url(https://cdn.framework7.io/placeholder/nature-1000x600-3.jpg)' }}
  34. >Journey To Mountains</CardHeader>
  35. <CardContent>
  36. <p className="date">Posted on January 21, 2015</p>
  37. <p>Quisque eget vestibulum nulla. Quisque quis dui quis ex ultricies efficitur vitae non felis. Phasellus quis nibh hendrerit...</p>
  38. </CardContent>
  39. <CardFooter>
  40. <Link>Like</Link>
  41. <Link>Read more</Link>
  42. </CardFooter>
  43. </Card>
  44. <Card className="demo-card-header-pic">
  45. <CardHeader
  46. className="no-border"
  47. valign="bottom"
  48. style={{ backgroundImage: 'url(https://cdn.framework7.io/placeholder/people-1000x600-6.jpg)' }}
  49. >Journey To Mountains</CardHeader>
  50. <CardContent>
  51. <p className="date">Posted on January 21, 2015</p>
  52. <p>Quisque eget vestibulum nulla. Quisque quis dui quis ex ultricies efficitur vitae non felis. Phasellus quis nibh hendrerit...</p>
  53. </CardContent>
  54. <CardFooter>
  55. <Link>Like</Link>
  56. <Link>Read more</Link>
  57. </CardFooter>
  58. </Card>
  59. <BlockTitle>Facebook Cards</BlockTitle>
  60. <Card className="demo-facebook-card">
  61. <CardHeader className="no-border">
  62. <div className="demo-facebook-avatar"><img src="https://cdn.framework7.io/placeholder/people-68x68-1.jpg" width="34" height="34"/></div>
  63. <div className="demo-facebook-name">John Doe</div>
  64. <div className="demo-facebook-date">Monday at 3:47 PM</div>
  65. </CardHeader>
  66. <CardContent padding={false}>
  67. <img src="https://cdn.framework7.io/placeholder/nature-1000x700-8.jpg" width="100%"/>
  68. </CardContent>
  69. <CardFooter className="no-border">
  70. <Link>Like</Link>
  71. <Link>Comment</Link>
  72. <Link>Share</Link>
  73. </CardFooter>
  74. </Card>
  75. <Card className="demo-facebook-card">
  76. <CardHeader className="no-border">
  77. <div className="demo-facebook-avatar"><img src="https://cdn.framework7.io/placeholder/people-68x68-1.jpg" width="34" height="34"/></div>
  78. <div className="demo-facebook-name">John Doe</div>
  79. <div className="demo-facebook-date">Monday at 2:15 PM</div>
  80. </CardHeader>
  81. <CardContent>
  82. <p>What a nice photo i took yesterday!</p><img src="https://cdn.framework7.io/placeholder/nature-1000x700-8.jpg" width="100%"/>
  83. <p className="likes">Likes: 112 &nbsp;&nbsp; Comments: 43</p>
  84. </CardContent>
  85. <CardFooter className="no-border">
  86. <Link>Like</Link>
  87. <Link>Comment</Link>
  88. <Link>Share</Link>
  89. </CardFooter>
  90. </Card>
  91. <BlockTitle>Cards With List View</BlockTitle>
  92. <Card>
  93. <CardContent padding={false}>
  94. <List>
  95. <ListItem link="#">Link 1</ListItem>
  96. <ListItem link="#">Link 2</ListItem>
  97. <ListItem link="#">Link 3</ListItem>
  98. <ListItem link="#">Link 4</ListItem>
  99. <ListItem link="#">Link 5</ListItem>
  100. </List>
  101. </CardContent>
  102. </Card>
  103. <Card title="New Releases:">
  104. <CardContent padding={false}>
  105. <List medial-list>
  106. <ListItem
  107. title="Yellow Submarine"
  108. subtitle="Beatles"
  109. >
  110. <img slot="media" src="https://cdn.framework7.io/placeholder/fashion-88x88-4.jpg" width="44"/>
  111. </ListItem>
  112. <ListItem
  113. title="Don't Stop Me Now"
  114. subtitle="Queen"
  115. >
  116. <img slot="media" src="https://cdn.framework7.io/placeholder/fashion-88x88-5.jpg" width="44"/>
  117. </ListItem>
  118. <ListItem
  119. title="Billie Jean"
  120. subtitle="Michael Jackson"
  121. >
  122. <img slot="media" src="https://cdn.framework7.io/placeholder/fashion-88x88-6.jpg" width="44"/>
  123. </ListItem>
  124. </List>
  125. </CardContent>
  126. <CardFooter>
  127. <span>January 20, 2015</span>
  128. <span>5 comments</span>
  129. </CardFooter>
  130. </Card>
  131. <BlockTitle>Expandable Cards</BlockTitle>
  132. <Card expandable>
  133. <CardContent padding={false}>
  134. <div className="bg-color-red" style={{height: '300px'}}>
  135. <CardHeader textColor="white" className="display-block">
  136. Framework7
  137. <br />
  138. <small style={{opacity: 0.7}}>Build Mobile Apps</small>
  139. </CardHeader>
  140. <Link cardClose color="white" className="card-opened-fade-in" style={{position: 'absolute', right: '15px', top: '15px'}} iconF7="close_round_fill" />
  141. </div>
  142. <div className="card-content-padding">
  143. <p>Framework7 - is a free and open source HTML mobile framework to develop hybrid mobile apps or web apps with iOS or Android (Material) native look and feel...</p>
  144. </div>
  145. </CardContent>
  146. </Card>
  147. <Card expandable>
  148. <CardContent padding={false}>
  149. <div className="bg-color-yellow" style={{height: '300px'}}>
  150. <CardHeader textColor="black" className="display-block">
  151. Framework7
  152. <br/>
  153. <small style={{opacity: 0.7}}>Build Mobile Apps</small>
  154. </CardHeader>
  155. <Link cardClose color="black" className="card-opened-fade-in" style={{position: 'absolute', right: '15px', top: '15px'}} iconF7="close_round_fill" />
  156. </div>
  157. <div className="card-content-padding">
  158. <p>Framework7 - is a free and open source HTML mobile framework to develop hybrid mobile apps or web apps with iOS or Android (Material) native look and feel...</p>
  159. </div>
  160. </CardContent>
  161. </Card>