Button - 图1

Button React Component

Button React component represents Framework7’s Button elements.

Button Components

There are following components included:

  • **Button** / **F7Button** - single button
  • **Segmented** / **F7Segmented** - segmented wrapper for buttons

Button Properties

Button component has almost the same properties as the Link component but with few additional button-specific properties:

PropTypeDefaultDescription
<Segmented> properties
raisedbooleanfalseMakes segmented raised
raisedIosbooleanfalseMakes segmented raised only in iOS theme
raisedMdbooleanfalseMakes segmented raised only in MD theme
raisedAurorabooleanfalseMakes segmented raised only in Aurora theme
roundbooleanfalseMakes segmented round
roundIosbooleanfalseMakes segmented round only in iOS theme
roundMdbooleanfalseMakes segmented round only in MD theme
roundAurorabooleanfalseMakes segmented round only in Aurora theme
tagstringdivTag used to render Segmented element
<Button> properties
typestringIf it is one of submit, button or reset then it will be rendered as <button> element with same type attribute
tabLinkstring
boolean
Enables tab link and specify CSS selector of the target tab (if specified as a string)
tabLinkActivebooleanfalseMakes this tab link active
activebooleanfalseMakes this button active state when used in Segmented. Must be used instead of tab-link-active
textstringButton text label
noFastClickbooleanDisables fast click
tooltipstringButton tooltip text to show on button hover/press
roundbooleanfalseMakes button round
roundIosbooleanfalseMakes button round for iOS theme only
roundMdbooleanfalseMakes button round for MD theme only
roundAurorabooleanfalseMakes button round for Aurora theme only
largebooleanfalseMakes large button
largeIosbooleanfalseMakes large button for iOS theme only
largeMdbooleanfalseMakes large button for MD theme only
largeAurorabooleanfalseMakes large button for Aurora theme only
smallbooleanfalseMakes small button
smallIosbooleanfalseMakes small button for iOS theme only
smallMdbooleanfalseMakes small button for MD theme only
smallAurorabooleanfalseMakes small button for Aurora theme only
fillbooleanfalseMakes button filled color
fillIosbooleanfalseMakes button filled color for iOS theme only
fillMdbooleanfalseMakes button filled color for MD theme only
fillAurorabooleanfalseMakes button filled color for Aurora theme only
raisedbooleanfalseMakes button raised
raisedIosbooleanfalseMakes button raised only in iOS theme
raisedMdbooleanfalseMakes button raised only in MD theme
raisedAurorabooleanfalseMakes button raised only in Aurora theme
outlinebooleanfalseMakes button outline
outlineIosbooleanfalseMakes button outline only in iOS theme
outlineMdbooleanfalseMakes button outline only in MD theme
outlineAurorabooleanfalseMakes button outline only in Aurora theme
<Button> icon related properties
iconSizestring
number
Icon size in px
iconColorstringIcon color. One of the default colors
iconstringCustom icon class
iconF7stringName of F7 Icons font icon
iconMaterialstringName of Material Icons font icon
iconFastringName of Font Awesome font icon
iconIonstringName of Ionicons font icon
iconIosstringIcon to be used in case of iOS theme is used. Consists of icon family and icon name divided by colon, e.g. f7:home or ion:home
iconMdstringIcon to be used in case of MD theme is used. Consists of icon family and icon name divided by colon, e.g. material:home or fa:home
iconAurorastringIcon to be used in case of Aurora theme is used. Consists of icon family and icon name divided by colon, e.g. f7:home or fa:home
<Button> navigation/router related properties
hrefstring
boolean
#URL of the page to load. In case of boolean href=”false” it won’t add href tag
targetstringValue of link target attribute, e.g. _blank, _self, etc.
viewstringCSS selector of the View to load the page
externalbooleanEnable to bypass Framework7’s link click handler
backbooleanEnables back navigation link
forcebooleanForce page to load and ignore previous page in history (use together with back prop)
reloadCurrentbooleanReloads new page instead of the currently active one
reloadPreviousbooleanReplace the previous page in history with the new one from route
reloadAllbooleanLoad new page and remove all previous pages from history and DOM
reloadDetailbooleanReload Detail page in Master Detail view
animatebooleanDisables pages animation
ignoreCachebooleanIgnores caching
routeTabIdstringRoutable Tab id
routePropsobjectObject with additional props that will be passed to target route component
preventRouterbooleanfalseIf set, then it won’t be processed by Framework7 router
<Button> action related properties
panelOpenstring
boolean
Defines panel to open. Can be left or right
panelClosebooleanCloses panel on click
panelTogglebooleanToggle (open/close) panel on click
actionsOpenstring
boolean
CSS selector of the action sheet to open on click
actionsClosestring
boolean
CSS selector of the action sheet to close on click. Or boolean property to close currently opened action sheet
popupOpenstring
boolean
CSS selector of the popup to open on click
popupClosestring
boolean
CSS selector of the popup to close on click. Or boolean property to close currently opened popup
popoverOpenstring
boolean
CSS selector of the popover to open on click
popoverClosestring
boolean
CSS selector of the popover to close on click. Or boolean property to close currently opened popover
sheetOpenstring
boolean
CSS selector of the sheet modal to open on click
sheetClosestring
boolean
CSS selector of the sheet modal to close on click. Or boolean property to close currently opened sheet modal
loginScreenOpenstring
boolean
CSS selector of the login screen to open on click
loginScreenClosestring
boolean
CSS selector of the login screen to close on click. Or boolean property to close currently opened login screen
sortableEnablestring
boolean
CSS selector of the Sortable list to open on click
sortableDisablestring
boolean
CSS selector of the Sortable list to close on click. Or boolean property to close currently opened Sortable list
sortableTogglestring
boolean
CSS selector of the Sortable list to toggle on click. Or boolean property to toggle currently opened/closed Sortable list
searchbarEnablestring
boolean
CSS selector of the Expandable Searchbar to be enabled on click. Or boolean property to enable the first found Searchbar
searchbarDisablestring
boolean
CSS selector of the Expandable Searchbar to be disabled on click. Or boolean property to disable the first found Searchbar
searchbarTogglestring
boolean
CSS selector of the Expandable Searchbar to toggle on click. Or boolean property to toggle the first found Searchbar
searchbarClearstring
boolean
CSS selector of the Expandable Searchbar to clear on click. Or boolean property to clear the first found Searchbar
cardOpenstring
boolean
CSS selector of the expandable card to open on click. Or boolean to open first found expandable card
cardClosestring
boolean
CSS selector of the expandable card to close on click. Or boolean property to close currently opened expandable card
cardPreventOpenbooleanClick on element with this prop won’t open its parent expandable card
menuClosebooleanCloses Menu dropdown on click

Button Events

EventDescription
<Button> events
clickEvent will be triggered after click on a button

Examples

  1. <BlockTitle>Usual Buttons</BlockTitle>
  2. <Block>
  3. <Row>
  4. <Col>
  5. <Button>Button</Button>
  6. </Col>
  7. <Col>
  8. <Button>Button</Button>
  9. </Col>
  10. <Col>
  11. <Button round>Round</Button>
  12. </Col>
  13. </Row>
  14. </Block>
  15. <BlockTitle>Fill Buttons</BlockTitle>
  16. <Block>
  17. <Row>
  18. <Col>
  19. <Button fill>Button</Button>
  20. </Col>
  21. <Col>
  22. <Button fill>Button</Button>
  23. </Col>
  24. <Col>
  25. <Button fill round>Round</Button>
  26. </Col>
  27. </Row>
  28. </Block>
  29. <BlockTitle>Outline Buttons</BlockTitle>
  30. <Block>
  31. <Row>
  32. <Col>
  33. <Button outline>Button</Button>
  34. </Col>
  35. <Col>
  36. <Button outline>Button</Button>
  37. </Col>
  38. <Col>
  39. <Button outline round>Round</Button>
  40. </Col>
  41. </Row>
  42. </Block>
  43. <BlockTitle>Raised Buttons</BlockTitle>
  44. <Block>
  45. <Row tag="p">
  46. <Col tag="span">
  47. <Button raised>Button</Button>
  48. </Col>
  49. <Col tag="span">
  50. <Button raised fill>Fill</Button>
  51. </Col>
  52. <Col tag="span">
  53. <Button raised outline>Outline</Button>
  54. </Col>
  55. </Row>
  56. <Row tag="p">
  57. <Col tag="span">
  58. <Button raised round>Round</Button>
  59. </Col>
  60. <Col tag="span">
  61. <Button raised fill round>Fill</Button>
  62. </Col>
  63. <Col tag="span">
  64. <Button raised outline round>Outline</Button>
  65. </Col>
  66. </Row>
  67. </Block>
  68. <BlockTitle>Segmented</BlockTitle>
  69. <Block>
  70. <Segmented raised tag="p">
  71. <Button>Button</Button>
  72. <Button>Button</Button>
  73. <Button active>Active</Button>
  74. </Segmented>
  75. <Segmented raised tag="p">
  76. <Button outline>Outline</Button>
  77. <Button outline>Outline</Button>
  78. <Button outline active>Active</Button>
  79. </Segmented>
  80. <Segmented raised round tag="p">
  81. <Button round>Button</Button>
  82. <Button round>Button</Button>
  83. <Button round active>Active</Button>
  84. </Segmented>
  85. <Segmented raised round tag="p">
  86. <Button round outline>Outline</Button>
  87. <Button round outline>Outline</Button>
  88. <Button round outline active>Active</Button>
  89. </Segmented>
  90. </Block>
  91. <BlockTitle>Large Buttons</BlockTitle>
  92. <Block>
  93. <Row tag="p">
  94. <Col tag="span">
  95. <Button large>Button</Button>
  96. </Col>
  97. <Col tag="span">
  98. <Button large fill>Fill</Button>
  99. </Col>
  100. </Row>
  101. <Row tag="p">
  102. <Col tag="span">
  103. <Button large raised>Raised</Button>
  104. </Col>
  105. <Col tag="span">
  106. <Button large raised fill>Raised Fill</Button>
  107. </Col>
  108. </Row>
  109. </Block>
  110. <BlockTitle>Small Buttons</BlockTitle>
  111. <Block>
  112. <Row tag="p">
  113. <Col tag="span">
  114. <Button large small>Button</Button>
  115. </Col>
  116. <Col tag="span">
  117. <Button large small outline>Outline</Button>
  118. </Col>
  119. <Col tag="span">
  120. <Button large small fill>Fill</Button>
  121. </Col>
  122. </Row>
  123. <Row tag="p">
  124. <Col tag="span">
  125. <Button large small round>Button</Button>
  126. </Col>
  127. <Col tag="span">
  128. <Button large small outline round>Outline</Button>
  129. </Col>
  130. <Col tag="span">
  131. <Button large small fill round>Fill</Button>
  132. </Col>
  133. </Row>
  134. </Block>
  135. <BlockTitle>Color Buttons</BlockTitle>
  136. <Block>
  137. <Row>
  138. <Col>
  139. <Button color="red">Red</Button>
  140. </Col>
  141. <Col>
  142. <Button color="green">Green</Button>
  143. </Col>
  144. <Col>
  145. <Button color="blue">Blue</Button>
  146. </Col>
  147. </Row>
  148. </Block>
  149. <BlockTitle>Color Fill Buttons</BlockTitle>
  150. <Block>
  151. <Row>
  152. <Col>
  153. <Button fill color="red">Red</Button>
  154. </Col>
  155. <Col>
  156. <Button fill color="green">Green</Button>
  157. </Col>
  158. <Col>
  159. <Button fill color="blue">Blue</Button>
  160. </Col>
  161. </Row>
  162. </Block>