Button - 图1

Button Vue Component

Button Vue component represents Framework7’s Button elements.

Button Components

There are following components included:

  • **f7-button** - single button
  • **f7-segmented** - 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
<f7-segmented> properties
raisedbooleanfalseMakes segmented raised
raised-iosbooleanfalseMakes segmented raised only in iOS theme
raised-mdbooleanfalseMakes segmented raised only in MD theme
raised-aurorabooleanfalseMakes segmented raised only in Aurora theme
roundbooleanfalseMakes segmented round
round-iosbooleanfalseMakes segmented round only in iOS theme
round-mdbooleanfalseMakes segmented round only in MD theme
round-aurorabooleanfalseMakes segmented round only in Aurora theme
tagstringdivTag used to render Segmented element
<f7-button> properties
typestringIf it is one of submit, button or reset then it will be rendered as <button> element with same type attribute
tab-linkstring
boolean
Enables tab link and specify CSS selector of the target tab (if specified as a string)
tab-link-activebooleanfalseMakes this tab link active
activebooleanfalseMakes this button active state when used in Segmented. Must be used instead of tab-link-active
textstringButton text label
no-fast-clickbooleanDisables fast click
tooltipstringButton tooltip text to show on button hover/press
roundbooleanfalseMakes button round
round-iosbooleanfalseMakes button round for iOS theme only
round-mdbooleanfalseMakes button round for MD theme only
round-aurorabooleanfalseMakes button round for Aurora theme only
largebooleanfalseMakes large button
large-iosbooleanfalseMakes large button for iOS theme only
large-mdbooleanfalseMakes large button for MD theme only
large-aurorabooleanfalseMakes large button for Aurora theme only
smallbooleanfalseMakes small button
small-iosbooleanfalseMakes small button for iOS theme only
small-mdbooleanfalseMakes small button for MD theme only
small-aurorabooleanfalseMakes small button for Aurora theme only
fillbooleanfalseMakes button filled color
fill-iosbooleanfalseMakes button filled color for iOS theme only
fill-mdbooleanfalseMakes button filled color for MD theme only
fill-aurorabooleanfalseMakes button filled color for Aurora theme only
raisedbooleanfalseMakes button raised
raised-iosbooleanfalseMakes button raised only in iOS theme
raised-mdbooleanfalseMakes button raised only in MD theme
raised-aurorabooleanfalseMakes button raised only in Aurora theme
outlinebooleanfalseMakes button outline
outline-iosbooleanfalseMakes button outline only in iOS theme
outline-mdbooleanfalseMakes button outline only in MD theme
outline-aurorabooleanfalseMakes button outline only in Aurora theme
<f7-button> icon related properties
icon-sizestring
number
Icon size in px
icon-colorstringIcon color. One of the default colors
iconstringCustom icon class
icon-f7stringName of F7 Icons font icon
icon-materialstringName of Material Icons font icon
icon-fastringName of Font Awesome font icon
icon-ionstringName of Ionicons font icon
icon-iosstringIcon 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
icon-mdstringIcon 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
icon-aurorastringIcon to be used in case of Aurora theme is used. Consists of icon family and icon name divided by colon, e.g. material:home or fa:home
<f7-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)
reload-currentbooleanReloads new page instead of the currently active one
reload-previousbooleanReplace the previous page in history with the new one from route
reload-allbooleanLoad new page and remove all previous pages from history and DOM
reload-detailbooleanReload Detail page in Master Detail view
animatebooleanDisables pages animation
ignore-cachebooleanIgnores caching
route-tab-idstringRoutable Tab id
route-propsobjectObject with additional props that will be passed to target route component
prevent-routerbooleanfalseIf set, then it won’t be processed by Framework7 router
<f7-button> action related properties
panel-openstring
boolean
Defines panel to open. Can be left or right
panel-closebooleanCloses panel on click
panel-togglebooleanToggle (open/close) panel on click
actions-openstring
boolean
CSS selector of the action sheet to open on click
actions-closestring
boolean
CSS selector of the action sheet to close on click. Or boolean property to close currently opened action sheet
popup-openstring
boolean
CSS selector of the popup to open on click
popup-closestring
boolean
CSS selector of the popup to close on click. Or boolean property to close currently opened popup
popover-openstring
boolean
CSS selector of the popover to open on click
popover-closestring
boolean
CSS selector of the popover to close on click. Or boolean property to close currently opened popover
sheet-openstring
boolean
CSS selector of the sheet modal to open on click
sheet-closestring
boolean
CSS selector of the sheet modal to close on click. Or boolean property to close currently opened sheet modal
login-screen-openstring
boolean
CSS selector of the login screen to open on click
login-screen-closestring
boolean
CSS selector of the login screen to close on click. Or boolean property to close currently opened login screen
sortable-enablestring
boolean
CSS selector of the Sortable list to open on click
sortable-disablestring
boolean
CSS selector of the Sortable list to close on click. Or boolean property to close currently opened Sortable list
sortable-togglestring
boolean
CSS selector of the Sortable list to toggle on click. Or boolean property to toggle currently opened/closed Sortable list
searchbar-enablestring
boolean
CSS selector of the Expandable Searchbar to be enabled on click. Or boolean property to enable the first found Searchbar
searchbar-disablestring
boolean
CSS selector of the Expandable Searchbar to be disabled on click. Or boolean property to disable the first found Searchbar
searchbar-togglestring
boolean
CSS selector of the Expandable Searchbar to toggle on click. Or boolean property to toggle the first found Searchbar
searchbar-clearstring
boolean
CSS selector of the Expandable Searchbar to clear on click. Or boolean property to clear the first found Searchbar
card-openstring
boolean
CSS selector of the expandable card to open on click. Or boolean to open first found expandable card
card-closestring
boolean
CSS selector of the expandable card to close on click. Or boolean property to close currently opened expandable card
card-prevent-openbooleanClick on element with this prop won’t open its parent expandable card
menu-closebooleanCloses Menu dropdown on click

Button Events

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

Examples

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