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:house
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. material: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 be enabled on click
sortableDisablestring
boolean
CSS selector of the Sortable list to be disabled 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

<Page>
  <Navbar title="Buttons" />

  <BlockTitle>Usual Buttons</BlockTitle>
  <Block strong>
    <Row>
      <Col>
        <Button>Button</Button>
      </Col>
      <Col>
        <Button>Button</Button>
      </Col>
      <Col>
        <Button round>Round</Button>
      </Col>
    </Row>
  </Block>

  <BlockTitle>Fill Buttons</BlockTitle>
  <Block strong>
    <Row>
      <Col>
        <Button fill>Button</Button>
      </Col>
      <Col>
        <Button fill>Button</Button>
      </Col>
      <Col>
        <Button fill round>Round</Button>
      </Col>
    </Row>
  </Block>

  <BlockTitle>Outline Buttons</BlockTitle>
  <Block strong>
    <Row>
      <Col>
        <Button outline>Button</Button>
      </Col>
      <Col>
        <Button outline>Button</Button>
      </Col>
      <Col>
        <Button outline round>Round</Button>
      </Col>
    </Row>
  </Block>

  <BlockTitle>Raised Buttons</BlockTitle>
  <Block strong>
    <Row tag="p">
      <Col tag="span">
        <Button raised>Button</Button>
      </Col>
      <Col tag="span">
        <Button raised fill>Fill</Button>
      </Col>
      <Col tag="span">
        <Button raised outline>Outline</Button>
      </Col>
    </Row>
    <Row tag="p">
      <Col tag="span">
        <Button raised round>Round</Button>
      </Col>
      <Col tag="span">
        <Button raised fill round>Fill</Button>
      </Col>
      <Col tag="span">
        <Button raised outline round>Outline</Button>
      </Col>
    </Row>
  </Block>

  <BlockTitle>Segmented</BlockTitle>
  <Block strong>
    <Segmented raised tag="p">
      <Button>Button</Button>
      <Button>Button</Button>
      <Button active>Active</Button>
    </Segmented>
    <Segmented strong tag="p">
      <Button>Button</Button>
      <Button>Button</Button>
      <Button active>Active</Button>
    </Segmented>
    <Segmented tag="p">
      <Button outline>Outline</Button>
      <Button outline>Outline</Button>
      <Button outline active>Active</Button>
    </Segmented>
    <Segmented raised round tag="p">
      <Button round>Button</Button>
      <Button round>Button</Button>
      <Button round active>Active</Button>
    </Segmented>
    <Segmented round tag="p">
      <Button round outline>Outline</Button>
      <Button round outline>Outline</Button>
      <Button round outline active>Active</Button>
    </Segmented>
  </Block>

  <BlockTitle>Large Buttons</BlockTitle>
  <Block strong>
    <Row tag="p">
      <Col tag="span">
        <Button large>Button</Button>
      </Col>
      <Col tag="span">
        <Button large fill>Fill</Button>
      </Col>
    </Row>
    <Row tag="p">
      <Col tag="span">
        <Button large raised>Raised</Button>
      </Col>
      <Col tag="span">
        <Button large raised fill>Raised Fill</Button>
      </Col>
    </Row>
  </Block>

  <BlockTitle>Small Buttons</BlockTitle>
  <Block strong>
    <Row tag="p">
      <Col tag="span">
        <Button large small>Button</Button>
      </Col>
      <Col tag="span">
        <Button large small outline>Outline</Button>
      </Col>
      <Col tag="span">
        <Button large small fill>Fill</Button>
      </Col>
    </Row>
    <Row tag="p">
      <Col tag="span">
        <Button large small round>Button</Button>
      </Col>
      <Col tag="span">
        <Button large small outline round>Outline</Button>
      </Col>
      <Col tag="span">
        <Button large small fill round>Fill</Button>
      </Col>
    </Row>
  </Block>

  <BlockTitle>Color Buttons</BlockTitle>
  <Block strong>
    <Row>
      <Col>
        <Button color="red">Red</Button>
      </Col>
      <Col>
        <Button color="green">Green</Button>
      </Col>
      <Col>
        <Button color="blue">Blue</Button>
      </Col>
    </Row>
  </Block>

  <BlockTitle>Color Fill Buttons</BlockTitle>
  <Block strong>
    <Row>
      <Col>
        <Button fill color="red">Red</Button>
      </Col>
      <Col>
        <Button fill color="green">Green</Button>
      </Col>
      <Col>
        <Button fill color="blue">Blue</Button>
      </Col>
    </Row>
  </Block>
</Page>
  

<script>
  import {Page, Navbar, BlockTitle, Block, Row, Col, Button, Segmented} from 'framework7-svelte';
</script>