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:

Prop Type Default Description
<Segmented> properties
--- --- --- ---
raised boolean false Makes segmented raised
raisedIos boolean false Makes segmented raised only in iOS theme
raisedMd boolean false Makes segmented raised only in MD theme
raisedAurora boolean false Makes segmented raised only in Aurora theme
round boolean false Makes segmented round
roundIos boolean false Makes segmented round only in iOS theme
roundMd boolean false Makes segmented round only in MD theme
roundAurora boolean false Makes segmented round only in Aurora theme
strong boolean false Makes strong segmented
strongIos boolean false Makes strong segmented only in iOS theme
strongMd boolean false Makes strong segmented only in MD theme
strongAurora boolean false Makes strong segmented only in Aurora theme
tag string div Tag used to render Segmented element
<Button> properties
type string If it is one of submit, button or reset then it will be rendered as <button> element with same type attribute
tabLink string boolean Enables tab link and specify CSS selector of the target tab (if specified as a string)
tabLinkActive boolean false Makes this tab link active
active boolean false Makes this button active state when used in Segmented. Must be used instead of tab-link-active
text string Button text label
tooltip string Button tooltip text to show on button hover/press
tooltipTrigger string hover Defines 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
round boolean false Makes button round
roundIos boolean false Makes button round for iOS theme only
roundMd boolean false Makes button round for MD theme only
roundAurora boolean false Makes button round for Aurora theme only
large boolean false Makes large button
largeIos boolean false Makes large button for iOS theme only
largeMd boolean false Makes large button for MD theme only
largeAurora boolean false Makes large button for Aurora theme only
small boolean false Makes small button
smallIos boolean false Makes small button for iOS theme only
smallMd boolean false Makes small button for MD theme only
smallAurora boolean false Makes small button for Aurora theme only
fill boolean false Makes button filled color
fillIos boolean false Makes button filled color for iOS theme only
fillMd boolean false Makes button filled color for MD theme only
fillAurora boolean false Makes button filled color for Aurora theme only
raised boolean false Makes button raised
raisedIos boolean false Makes button raised only in iOS theme
raisedMd boolean false Makes button raised only in MD theme
raisedAurora boolean false Makes button raised only in Aurora theme
outline boolean false Makes button outline
outlineIos boolean false Makes button outline only in iOS theme
outlineMd boolean false Makes button outline only in MD theme
outlineAurora boolean false Makes button outline only in Aurora theme
<Button> icon related properties
iconSize string number Icon size in px
iconColor string Icon color. One of the default colors
icon string Custom icon class
iconF7 string Name of F7 Icons font icon
iconMaterial string Name of Material Icons font icon
iconIos string Icon to be used in case of iOS theme is used. Consists of icon family and icon name divided by colon, e.g. f7:home
iconMd string Icon to be used in case of MD theme is used. Consists of icon family and icon name divided by colon, e.g. material:home
iconAurora string Icon 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
href string boolean # URL of the page to load. In case of boolean href=”false” it won’t add href tag
target string Value of link target attribute, e.g. _blank, _self, etc.
view string CSS selector of the View to load the page. Or current to load in current view.
external boolean Enable to bypass Framework7’s link click handler
back boolean Enables back navigation link
force boolean Force page to load and ignore previous page in history (use together with back prop)
reloadCurrent boolean Reloads new page instead of the currently active one
reloadPrevious boolean Replace the previous page in history with the new one from route
reloadAll boolean Load new page and remove all previous pages from history and DOM
reloadDetail boolean Reload Detail page in Master Detail view
animate boolean Disables pages animation
transition string Name of the custom page transition
ignoreCache boolean Ignores caching
routeTabId string Routable Tab id
routeProps object Object with additional props that will be passed to target route component
preventRouter boolean false If set, then it won’t be processed by Framework7 router
<Button> action related properties
panelOpen string 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.
panelClose string boolean Closes panel on click
panelToggle string 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.
actionsOpen string boolean CSS selector of the action sheet to open on click
actionsClose string boolean CSS selector of the action sheet to close on click. Or boolean property to close currently opened action sheet
popupOpen string boolean CSS selector of the popup to open on click
popupClose string boolean CSS selector of the popup to close on click. Or boolean property to close currently opened popup
popoverOpen string boolean CSS selector of the popover to open on click
popoverClose string boolean CSS selector of the popover to close on click. Or boolean property to close currently opened popover
sheetOpen string boolean CSS selector of the sheet modal to open on click
sheetClose string boolean CSS selector of the sheet modal to close on click. Or boolean property to close currently opened sheet modal
loginScreenOpen string boolean CSS selector of the login screen to open on click
loginScreenClose string boolean CSS selector of the login screen to close on click. Or boolean property to close currently opened login screen
sortableEnable string boolean CSS selector of the Sortable list to open on click
sortableDisable string boolean CSS selector of the Sortable list to close on click. Or boolean property to close currently opened Sortable list
sortableToggle string boolean CSS selector of the Sortable list to toggle on click. Or boolean property to toggle currently opened/closed Sortable list
searchbarEnable string boolean CSS selector of the Expandable Searchbar to be enabled on click. Or boolean property to enable the first found Searchbar
searchbarDisable string boolean CSS selector of the Expandable Searchbar to be disabled on click. Or boolean property to disable the first found Searchbar
searchbarToggle string boolean CSS selector of the Expandable Searchbar to toggle on click. Or boolean property to toggle the first found Searchbar
searchbarClear string boolean CSS selector of the Expandable Searchbar to clear on click. Or boolean property to clear the first found Searchbar
cardOpen string boolean CSS selector of the expandable card to open on click. Or boolean to open first found expandable card
cardClose string boolean CSS selector of the expandable card to close on click. Or boolean property to close currently opened expandable card
cardPreventOpen boolean Click on element with this prop won’t open its parent expandable card
menuClose boolean Closes Menu dropdown on click

Button Events

Event Description
<Button> events
--- ---
click Event 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>

16. <BlockTitle>Fill Buttons</BlockTitle>
17. <Block>
18. <Row>
19. <Col>
20. <Button fill>Button</Button>
21. </Col>
22. <Col>
23. <Button fill>Button</Button>
24. </Col>
25. <Col>
26. <Button fill round>Round</Button>
27. </Col>
28. </Row>
29. </Block>

31. <BlockTitle>Outline Buttons</BlockTitle>
32. <Block>
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>

46. <BlockTitle>Raised Buttons</BlockTitle>
47. <Block>
48. <Row tag="p">
49. <Col tag="span">
50. <Button raised>Button</Button>
51. </Col>
52. <Col tag="span">
53. <Button raised fill>Fill</Button>
54. </Col>
55. <Col tag="span">
56. <Button raised outline>Outline</Button>
57. </Col>
58. </Row>
59. <Row tag="p">
60. <Col tag="span">
61. <Button raised round>Round</Button>
62. </Col>
63. <Col tag="span">
64. <Button raised fill round>Fill</Button>
65. </Col>
66. <Col tag="span">
67. <Button raised outline round>Outline</Button>
68. </Col>
69. </Row>
70. </Block>

72. <BlockTitle>Segmented</BlockTitle>
73. <Block>
74. <Segmented raised tag="p">
75. <Button>Button</Button>
76. <Button>Button</Button>
77. <Button active>Active</Button>
78. </Segmented>
79. <Segmented strong tag="p">
80. <Button>Button</Button>
81. <Button>Button</Button>
82. <Button active>Active</Button>
83. </Segmented>
84. <Segmented raised tag="p">
85. <Button outline>Outline</Button>
86. <Button outline>Outline</Button>
87. <Button outline active>Active</Button>
88. </Segmented>
89. <Segmented raised round tag="p">
90. <Button round>Button</Button>
91. <Button round>Button</Button>
92. <Button round active>Active</Button>
93. </Segmented>
94. <Segmented raised round tag="p">
95. <Button round outline>Outline</Button>
96. <Button round outline>Outline</Button>
97. <Button round outline active>Active</Button>
98. </Segmented>
99. </Block>

101. <BlockTitle>Large Buttons</BlockTitle>
102. <Block>
103. <Row tag="p">
104. <Col tag="span">
105. <Button large>Button</Button>
106. </Col>
107. <Col tag="span">
108. <Button large fill>Fill</Button>
109. </Col>
110. </Row>
111. <Row tag="p">
112. <Col tag="span">
113. <Button large raised>Raised</Button>
114. </Col>
115. <Col tag="span">
116. <Button large raised fill>Raised Fill</Button>
117. </Col>
118. </Row>
119. </Block>

121. <BlockTitle>Small Buttons</BlockTitle>
122. <Block>
123. <Row tag="p">
124. <Col tag="span">
125. <Button large small>Button</Button>
126. </Col>
127. <Col tag="span">
128. <Button large small outline>Outline</Button>
129. </Col>
130. <Col tag="span">
131. <Button large small fill>Fill</Button>
132. </Col>
133. </Row>
134. <Row tag="p">
135. <Col tag="span">
136. <Button large small round>Button</Button>
137. </Col>
138. <Col tag="span">
139. <Button large small outline round>Outline</Button>
140. </Col>
141. <Col tag="span">
142. <Button large small fill round>Fill</Button>
143. </Col>
144. </Row>
145. </Block>

147. <BlockTitle>Color Buttons</BlockTitle>
148. <Block>
149. <Row>
150. <Col>
151. <Button color="red">Red</Button>
152. </Col>
153. <Col>
154. <Button color="green">Green</Button>
155. </Col>
156. <Col>
157. <Button color="blue">Blue</Button>
158. </Col>
159. </Row>
160. </Block>

162. <BlockTitle>Color Fill Buttons</BlockTitle>
163. <Block>
164. <Row>
165. <Col>
166. <Button fill color="red">Red</Button>
167. </Col>
168. <Col>
169. <Button fill color="green">Green</Button>
170. </Col>
171. <Col>
172. <Button fill color="blue">Blue</Button>
173. </Col>
174. </Row>
175. </Block>

← Block / Content Block

Cards →