Button - 图1

Button Svelte Component

Button Svelte component represents Framework7’s Button elements.

Button Components

There are following components included:

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

← Block / Content Block

Cards →