UNPKG

react-onsenui

Version:

Onsen UI - React Components for Hybrid Cordova/PhoneGap Apps with Material Design and iOS UI components

78 lines (69 loc) 2.33 kB
import PropTypes from 'prop-types'; import 'onsenui/esm/elements/ons-fab'; import onsCustomElement from '../onsCustomElement'; /** * @original ons-fab * @category form * @tutorial react/Reference/fab * @description * [en] The Floating action button is a circular button defined in the [Material Design specification](https://www.google.com/design/spec/components/buttons-floating-action-button.html). They are often used to promote the primary action of the app. * It can be displayed either as an inline element or in one of the corners. Normally it will be positioned in the lower right corner of the screen. [/en] * [ja][/ja] * @example * <SpeedDial disabled={false} direction='right' onClick={() => console.log('test1')} position='left bottom'> <Fab> <Icon icon='fa-twitter' size={26} fixedWidth={false} style={{verticalAlign: 'middle'}} /> </Fab> <SpeedDialItem onClick={() => console.log('speed A')}> A </SpeedDialItem> <SpeedDialItem onClick={() => console.log('speed B')}> B </SpeedDialItem> <SpeedDialItem onClick={() => console.log('speed C')}> C </SpeedDialItem> <SpeedDialItem onClick={() => console.log('speed D')}> D </SpeedDialItem> </SpeedDial> */ const Fab = onsCustomElement('ons-fab'); Fab.propTypes = { /** * @name modifier * @type string * @required false * @description * [en]The appearance of the button.[/en] * [ja][/ja] */ modifier: PropTypes.string, /** * @name ripple * @type bool * @description * [en]If true, the button will have a ripple effect when tapped.[/en] * [ja][/ja] */ ripple: PropTypes.bool, /** * @name position * @type string * @required false * @description * [en]The position of the button. Should be a string like `"bottom right"` or `"top left"`. If this attribute is not defined it will be displayed as an inline element.[/en] * [ja][/ja] */ position: PropTypes.string, /** * @name disabled * @type bool * @description * [en] If true, the button will be disabled. [/en] * [ja][/ja] */ disabled: PropTypes.bool, /** * @name onClick * @type function * @description * [en] This function will be called ones the button is clicked. [/en] * [ja][/ja] */ onClick: PropTypes.func }; export default Fab;