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
strongbooleanfalseMakes strong segmented
strong-iosbooleanfalseMakes strong segmented only in iOS theme
strong-mdbooleanfalseMakes strong segmented only in MD theme
strong-aurorabooleanfalseMakes strong segmented 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
tooltipstringButton tooltip text to show on button hover/press
tooltip-triggerstringhoverDefines how to trigger (open) Tooltip. Can be hover, click or manual
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
<Button> preloader related properties
preloaderbooleanfalseEnables button to have preloader
loadingbooleanfalseControls button state to show/hide preloader and hide/show button text (switch button to loading state)
preloader-colorstringbutton's preloader color
preloader-sizenumber
string
button's preloader size
<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-iosstringIcon to be used in case of iOS theme is used. Consists of icon family and icon name divided by colon, e.g. f7:house
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
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
<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. Or current to load in current view.
externalbooleanEnable to bypass Framework7's link click handler
backbooleanEnables back navigation link
open-instringAllows open page route as modal or panel. Can be popup, loginScreen, sheet, popover or panel
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
transitionstringName of the custom page transition
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
CSS selector of panel to open on click. Or can be left or right if there is only left or right panel in DOM.
panel-closestring
boolean
Closes panel on click
panel-togglestring
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.
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 be enabled on click
sortable-disablestring
boolean
CSS selector of the Sortable list to be disabled 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

<template>
<f7-page>
  <f7-navbar title="Buttons"></f7-navbar>

  <f7-block-title>Usual Buttons</f7-block-title>
  <f7-block strong>
    <f7-row>
      <f7-col>
        <f7-button>Button</f7-button>
      </f7-col>
      <f7-col>
        <f7-button>Button</f7-button>
      </f7-col>
      <f7-col>
        <f7-button round>Round</f7-button>
      </f7-col>
    </f7-row>
  </f7-block>

  <f7-block-title>Fill Buttons</f7-block-title>
  <f7-block strong>
    <f7-row>
      <f7-col>
        <f7-button fill>Button</f7-button>
      </f7-col>
      <f7-col>
        <f7-button fill>Button</f7-button>
      </f7-col>
      <f7-col>
        <f7-button fill round>Round</f7-button>
      </f7-col>
    </f7-row>
  </f7-block>

  <f7-block-title>Outline Buttons</f7-block-title>
  <f7-block strong>
    <f7-row>
      <f7-col>
        <f7-button outline>Button</f7-button>
      </f7-col>
      <f7-col>
        <f7-button outline>Button</f7-button>
      </f7-col>
      <f7-col>
        <f7-button outline round>Round</f7-button>
      </f7-col>
    </f7-row>
  </f7-block>

  <f7-block-title>Raised Buttons</f7-block-title>
  <f7-block strong>
    <f7-row tag="p">
      <f7-col tag="span">
        <f7-button raised>Button</f7-button>
      </f7-col>
      <f7-col tag="span">
        <f7-button raised fill>Fill</f7-button>
      </f7-col>
      <f7-col tag="span">
        <f7-button raised outline>Outline</f7-button>
      </f7-col>
    </f7-row>
    <f7-row tag="p">
      <f7-col tag="span">
        <f7-button raised round>Round</f7-button>
      </f7-col>
      <f7-col tag="span">
        <f7-button raised fill round>Fill</f7-button>
      </f7-col>
      <f7-col tag="span">
        <f7-button raised outline round>Outline</f7-button>
      </f7-col>
    </f7-row>
  </f7-block>

  <f7-block-title>Segmented</f7-block-title>
  <f7-block strong>
    <f7-segmented raised tag="p">
      <f7-button>Button</f7-button>
      <f7-button>Button</f7-button>
      <f7-button active>Active</f7-button>
    </f7-segmented>
    <f7-segmented strong tag="p">
      <f7-button>Button</f7-button>
      <f7-button>Button</f7-button>
      <f7-button active>Active</f7-button>
    </f7-segmented>
    <f7-segmented tag="p">
      <f7-button outline>Outline</f7-button>
      <f7-button outline>Outline</f7-button>
      <f7-button outline active>Active</f7-button>
    </f7-segmented>
    <f7-segmented raised round tag="p">
      <f7-button round>Button</f7-button>
      <f7-button round>Button</f7-button>
      <f7-button round active>Active</f7-button>
    </f7-segmented>
    <f7-segmented round tag="p">
      <f7-button round outline>Outline</f7-button>
      <f7-button round outline>Outline</f7-button>
      <f7-button round outline active>Active</f7-button>
    </f7-segmented>
  </f7-block>

  <f7-block-title>Large Buttons</f7-block-title>
  <f7-block strong>
    <f7-row tag="p">
      <f7-col tag="span">
        <f7-button large>Button</f7-button>
      </f7-col>
      <f7-col tag="span">
        <f7-button large fill>Fill</f7-button>
      </f7-col>
    </f7-row>
    <f7-row tag="p">
      <f7-col tag="span">
        <f7-button large raised>Raised</f7-button>
      </f7-col>
      <f7-col tag="span">
        <f7-button large raised fill>Raised Fill</f7-button>
      </f7-col>
    </f7-row>
  </f7-block>

  <f7-block-title>Small Buttons</f7-block-title>
  <f7-block strong>
    <f7-row tag="p">
      <f7-col tag="span">
        <f7-button large small>Button</f7-button>
      </f7-col>
      <f7-col tag="span">
        <f7-button large small outline>Outline</f7-button>
      </f7-col>
      <f7-col tag="span">
        <f7-button large small fill>Fill</f7-button>
      </f7-col>
    </f7-row>
    <f7-row tag="p">
      <f7-col tag="span">
        <f7-button large small round>Button</f7-button>
      </f7-col>
      <f7-col tag="span">
        <f7-button large small outline round>Outline</f7-button>
      </f7-col>
      <f7-col tag="span">
        <f7-button large small fill round>Fill</f7-button>
      </f7-col>
    </f7-row>
  </f7-block>

  <f7-block-title>Preloader Button</f7-block-title>
  <f7-block strong>
    <f7-button fill preloader :loading="isLoading" @click="load"> Load </f7-button>
  </f7-block>

  <f7-block-title>Color Buttons</f7-block-title>
  <f7-block strong>
    <f7-row>
      <f7-col>
        <f7-button color="red">Red</f7-button>
      </f7-col>
      <f7-col>
        <f7-button color="green">Green</f7-button>
      </f7-col>
      <f7-col>
        <f7-button color="blue">Blue</f7-button>
      </f7-col>
    </f7-row>
  </f7-block>

  <f7-block-title>Color Fill Buttons</f7-block-title>
  <f7-block strong>
    <f7-row>
      <f7-col>
        <f7-button fill color="red">Red</f7-button>
      </f7-col>
      <f7-col>
        <f7-button fill color="green">Green</f7-button>
      </f7-col>
      <f7-col>
        <f7-button fill color="blue">Blue</f7-button>
      </f7-col>
    </f7-row>
  </f7-block>
</f7-page>
</template>

<script>
import { ref } from 'vue';

export default {
  setup() {
    const isLoading = ref(false);
    const load = () => {
      if (isLoading.value) return;
      isLoading.value = true;
      setTimeout(() => {
        isLoading.value = false;
      }, 4000);
    };

    return {
      isLoading,
      load,
    };
  },
};
</script>