
Floating Action Button Vue Component
Floating action buttons (FABs) are used for a promoted action. They are distinguished by a circled icon floating above the UI and have motion behaviors that include morphing, launching, and a transferring anchor point.
Floating Action Button Vue component represents Floating Action Button element.
FAB Components
There are following components included:
**f7-fab**- main FAB element**f7-fab-buttons**- wrapper for multiple FAB buttons used as Speed Dial FAB**f7-fab-button**- single FAB Speed Dial button
FAB Properties
| Prop | Type | Default | Description |
|---|---|---|---|
| <f7-fab> properties | |||
| --- | --- | --- | --- |
| href | string boolean | URL of the page to load (if set). Will set href attribute on main FAB link. In case of boolean href=”false” it won’t add href tag |
|
| target | string | Value of link target attribute, e.g. _blank, _self, etc. |
|
| position | string | right-bottom | FAB position. Can be one of the following: - right-bottom - center-bottom - left-bottom - right-center - center-center - left-center - right-top - center-top - left-top |
| morph-to | string | String CSS selector of the FAB morph target | |
| text | string | FAB Button text. If specified, then it will be displayed as Extended Fab with text label | |
| tooltip | string | FAB tooltip text to show on button hover/press | |
| <f7-fab-buttons> properties | |||
| position | string | top | Speed dial buttons position, can be one of the following: - top - buttons will appear on top of FAB - right - buttons will appear on right of FAB - bottom - buttons will appear on bottom of FAB - left - buttons will appear on left of FAB - center - buttons will appear around of FAB |
| <f7-fab-button> properties | |||
| fab-close | boolean | false | When enabled then clicking on this button will close the FAB |
| target | string | Value of link target attribute, e.g. _blank, _self, etc. |
|
| label | string | Button text label | |
| tooltip | string | Button tooltip text to show on button hover/press |
FAB Events
| Event | Description |
|---|---|
| <f7-fab> events | |
| --- | --- |
| click | Event will be triggered after click on FAB |
| <f7-fab-button> events | |
| click | Event will be triggered after click on FAB Speed Dial button |
FAB Slots
FAB Vue component (<f7-fab>) has additional slots for custom elements:
**default**- child element will be inserted inside of the main FAB link<a>element. But if the child isf7-fab-buttons, then it will be inserted in the end of the main FAB element**link**- child element will be inserted inside of the main FAB link<a>element**root**- child element will be inserted in the end of the main FAB element**text**- child element will be inserted in the text element of the Extended FAB
Examples
1. <f7-page>
2. <f7-navbar title="Floating Action Button"></f7-navbar>
4. <!-- Toolbar FAB Morph Target -->
5. <f7-toolbar bottom class="fab-morph-target">
6. <f7-link>Link 1</f7-link>
7. <f7-link>Link 2</f7-link>
8. <f7-link>Link 3</f7-link>
9. </f7-toolbar>
11. <!-- FAB Left Top (Yellow) -->
12. <f7-fab position="left-top" slot="fixed" color="yellow">
13. <f7-icon ios="f7:add" aurora="f7:add" md="material:add"></f7-icon>
14. <f7-icon ios="f7:close" aurora="f7:close" md="material:close"></f7-icon>
15. <f7-fab-buttons position="bottom">
16. <f7-fab-button>1</f7-fab-button>
17. <f7-fab-button>2</f7-fab-button>
18. <f7-fab-button>3</f7-fab-button>
19. </f7-fab-buttons>
20. </f7-fab>
22. <!-- FAB Right Top (Pink) -->
23. <f7-fab position="right-top" slot="fixed" color="pink">
24. <f7-icon ios="f7:add" aurora="f7:add" md="material:add"></f7-icon>
25. <f7-icon ios="f7:close" aurora="f7:close" md="material:close"></f7-icon>
26. <f7-fab-buttons position="left">
27. <f7-fab-button>1</f7-fab-button>
28. <f7-fab-button>2</f7-fab-button>
29. <f7-fab-button>3</f7-fab-button>
30. </f7-fab-buttons>
31. </f7-fab>
33. <!-- FAB Center (Green) -->
34. <f7-fab position="center-center" slot="fixed" color="green">
35. <f7-icon ios="f7:add" aurora="f7:add" md="material:add"></f7-icon>
36. <f7-icon ios="f7:close" aurora="f7:close" md="material:close"></f7-icon>
37. <f7-fab-buttons position="center">
38. <f7-fab-button>1</f7-fab-button>
39. <f7-fab-button>2</f7-fab-button>
40. <f7-fab-button>3</f7-fab-button>
41. <f7-fab-button>4</f7-fab-button>
42. </f7-fab-buttons>
43. </f7-fab>
45. <!-- FAB Left Bottom (Blue) -->
46. <!-- Will morph to Toolbar -->
47. <f7-fab position="left-bottom" slot="fixed" morph-to=".toolbar.fab-morph-target">
48. <f7-icon ios="f7:add" aurora="f7:add" md="material:add"></f7-icon>
49. <f7-icon ios="f7:close" aurora="f7:close" md="material:close"></f7-icon>
50. </f7-fab>
52. <!-- FAB Right Bottom (Orange) -->
53. <f7-fab position="right-bottom" slot="fixed" color="orange">
54. <f7-icon ios="f7:add" aurora="f7:add" md="material:add"></f7-icon>
55. <f7-icon ios="f7:close" aurora="f7:close" md="material:close"></f7-icon>
56. <f7-fab-buttons position="top">
57. <f7-fab-button label="Action 1">1</f7-fab-button>
58. <f7-fab-button label="Action 2">2</f7-fab-button>
59. </f7-fab-buttons>
60. </f7-fab>
62. <!-- Extended FAB Center Bottom (Red) -->
63. <f7-fab position="center-bottom" slot="fixed" text="Create" color="red">
64. <f7-icon ios="f7:add" aurora="f7:add" md="material:add"></f7-icon>
65. </f7-fab>
67. <f7-block>
68. <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quia, quo rem beatae, delectus eligendi est saepe molestias ... voluptatibus eligendi.</p>
69. </f7-block>
70. </f7-page>
