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
strongbooleanfalseMakes strong segmented
strongIosbooleanfalseMakes strong segmented only in iOS theme
strongMdbooleanfalseMakes strong segmented only in MD theme
strongAurorabooleanfalseMakes strong segmented 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
tooltipstringButton tooltip text to show on button hover/press
tooltipTriggerstringhoverDefines how to trigger (open) Tooltip. Can be hover or click. If hover tooltip will be toggled on mouse hover on desktop, and with tap and hold on touch devices
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
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
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
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
<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. Or current to load in current view.
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
transitionstringName of the custom page transition
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
CSS selector of panel to open on click. Or can be left or right if there is only left or right panel in DOM.
panelClosestring
boolean
Closes panel on click
panelTogglestring
boolean
CSS selector of panel to toggle on click. Or can be left or right if there is only left or right panel in DOM.
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 strong tag="p">
  76. <Button>Button</Button>
  77. <Button>Button</Button>
  78. <Button active>Active</Button>
  79. </Segmented>
  80. <Segmented raised tag="p">
  81. <Button outline>Outline</Button>
  82. <Button outline>Outline</Button>
  83. <Button outline active>Active</Button>
  84. </Segmented>
  85. <Segmented raised round tag="p">
  86. <Button round>Button</Button>
  87. <Button round>Button</Button>
  88. <Button round active>Active</Button>
  89. </Segmented>
  90. <Segmented raised round tag="p">
  91. <Button round outline>Outline</Button>
  92. <Button round outline>Outline</Button>
  93. <Button round outline active>Active</Button>
  94. </Segmented>
  95. </Block>
  96. <BlockTitle>Large Buttons</BlockTitle>
  97. <Block>
  98. <Row tag="p">
  99. <Col tag="span">
  100. <Button large>Button</Button>
  101. </Col>
  102. <Col tag="span">
  103. <Button large fill>Fill</Button>
  104. </Col>
  105. </Row>
  106. <Row tag="p">
  107. <Col tag="span">
  108. <Button large raised>Raised</Button>
  109. </Col>
  110. <Col tag="span">
  111. <Button large raised fill>Raised Fill</Button>
  112. </Col>
  113. </Row>
  114. </Block>
  115. <BlockTitle>Small Buttons</BlockTitle>
  116. <Block>
  117. <Row tag="p">
  118. <Col tag="span">
  119. <Button large small>Button</Button>
  120. </Col>
  121. <Col tag="span">
  122. <Button large small outline>Outline</Button>
  123. </Col>
  124. <Col tag="span">
  125. <Button large small fill>Fill</Button>
  126. </Col>
  127. </Row>
  128. <Row tag="p">
  129. <Col tag="span">
  130. <Button large small round>Button</Button>
  131. </Col>
  132. <Col tag="span">
  133. <Button large small outline round>Outline</Button>
  134. </Col>
  135. <Col tag="span">
  136. <Button large small fill round>Fill</Button>
  137. </Col>
  138. </Row>
  139. </Block>
  140. <BlockTitle>Color Buttons</BlockTitle>
  141. <Block>
  142. <Row>
  143. <Col>
  144. <Button color="red">Red</Button>
  145. </Col>
  146. <Col>
  147. <Button color="green">Green</Button>
  148. </Col>
  149. <Col>
  150. <Button color="blue">Blue</Button>
  151. </Col>
  152. </Row>
  153. </Block>
  154. <BlockTitle>Color Fill Buttons</BlockTitle>
  155. <Block>
  156. <Row>
  157. <Col>
  158. <Button fill color="red">Red</Button>
  159. </Col>
  160. <Col>
  161. <Button fill color="green">Green</Button>
  162. </Col>
  163. <Col>
  164. <Button fill color="blue">Blue</Button>
  165. </Col>
  166. </Row>
  167. </Block>

← Block / Content Block

Cards →