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. Affects MD theme only |
round | boolean | false | Makes segmented round |
tag | string | div | Tag used to render Segmented element |
<Button> properties | |||
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 | |
noFastClick | boolean | Disables fast click | |
tooltip | string | Button tooltip text to show on button hover/press | |
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 |
big | boolean | false | Makes big button |
bigIos | boolean | false | Makes big button for iOS theme only |
bigMd | boolean | false | Makes big button for MD 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 |
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 |
raised | boolean | false | Makes button raised. Affects MD theme only |
outline | boolean | false | Makes button outline. Affects MD theme only |
<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 | |
iconFa | string | Name of Font Awesome font icon | |
iconIon | string | Name of Ionicons 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 or ion: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 or fa: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 | |
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 | |
animate | boolean | Disables pages animation | |
ignoreCache | boolean | Ignores caching | |
routeTabId | string | Routable Tab id | |
routeProps | object | Object with additional props that will be passed to target route component | |
<Button> action related properties | |||
panelOpen | string boolean | Defines panel to open. Can be left or right | |
panelClose | boolean | Closes panel on click | |
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 |
Button Events
Event | Description |
---|---|
<Button> events | |
click | Event will be triggered after click on a button |
Examples
<BlockTitle>Usual Buttons</BlockTitle>
<Block>
<Row>
<Col>
<Button>Button</Button>
</Col>
<Col>
<Button>Button</Button>
</Col>
<Col>
<Button round>Round</Button>
</Col>
</Row>
</Block>
<BlockTitle>Fill Buttons</BlockTitle>
<Block>
<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 (MD-theme only)</BlockTitle>
<Block>
<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 (MD-theme only)</BlockTitle>
<Block>
<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>
<Segmented raised tag="p">
<Button>Button</Button>
<Button>Button</Button>
<Button active>Active</Button>
</Segmented>
<Segmented raised 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 raised round tag="p">
<Button round outline>Outline</Button>
<Button round outline>Outline</Button>
<Button round outline active>Active</Button>
</Segmented>
</Block>
<BlockTitle>Big Buttons</BlockTitle>
<Block>
<Row tag="p">
<Col tag="span">
<Button big>Button</Button>
</Col>
<Col tag="span">
<Button big fill>Fill</Button>
</Col>
</Row>
<Row tag="p">
<Col tag="span">
<Button big raised>Raised</Button>
</Col>
<Col tag="span">
<Button big raised fill>Raised Fill</Button>
</Col>
</Row>
</Block>
<BlockTitle>Small Buttons</BlockTitle>
<Block>
<Row tag="p">
<Col tag="span">
<Button big small>Button</Button>
</Col>
<Col tag="span">
<Button big small outline>Outline</Button>
</Col>
<Col tag="span">
<Button big small fill>Fill</Button>
</Col>
</Row>
<Row tag="p">
<Col tag="span">
<Button big small round>Button</Button>
</Col>
<Col tag="span">
<Button big small outline round>Outline</Button>
</Col>
<Col tag="span">
<Button big small fill round>Fill</Button>
</Col>
</Row>
</Block>
<BlockTitle>Color Buttons</BlockTitle>
<Block>
<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>
<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>
当前内容版权归 Framework7 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 Framework7 .