From e45ece3cd7ce1013a6b96068f526a13b30cd0adf Mon Sep 17 00:00:00 2001 From: Sean Chamberlain Date: Mon, 23 Jul 2018 13:18:39 +0930 Subject: [PATCH] Allow a tooltip placement prop on SpeedDialAction --- .../src/SpeedDialAction/SpeedDialAction.d.ts | 1 + .../src/SpeedDialAction/SpeedDialAction.js | 8 +++++++- pages/lab/api/speed-dial-action.md | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/material-ui-lab/src/SpeedDialAction/SpeedDialAction.d.ts b/packages/material-ui-lab/src/SpeedDialAction/SpeedDialAction.d.ts index cb8ea6d5148351..b6662a98fea99c 100644 --- a/packages/material-ui-lab/src/SpeedDialAction/SpeedDialAction.d.ts +++ b/packages/material-ui-lab/src/SpeedDialAction/SpeedDialAction.d.ts @@ -8,6 +8,7 @@ export interface SpeedDialActionProps ButtonProps?: Partial; delay?: number; icon: React.ReactNode; + tooltipPosition?: string; tooltipTitle?: React.ReactNode; } diff --git a/packages/material-ui-lab/src/SpeedDialAction/SpeedDialAction.js b/packages/material-ui-lab/src/SpeedDialAction/SpeedDialAction.js index 0d1d1319ff3a9e..808a28d3e619bf 100644 --- a/packages/material-ui-lab/src/SpeedDialAction/SpeedDialAction.js +++ b/packages/material-ui-lab/src/SpeedDialAction/SpeedDialAction.js @@ -55,6 +55,7 @@ class SpeedDialAction extends React.Component { onClick, open, tooltipTitle, + tooltipPosition, ...other } = this.props; @@ -63,7 +64,7 @@ class SpeedDialAction extends React.Component { id={id} className={classNames(classes.root, classNameProp)} title={tooltipTitle} - placement="left" + placement={tooltipPosition} onClose={this.handleTooltipClose} onOpen={this.handleTooltipOpen} open={open && this.state.tooltipOpen} @@ -124,6 +125,10 @@ SpeedDialAction.propTypes = { * @ignore */ open: PropTypes.bool, + /** + * Placement of the tooltip. + */ + tooltipPosition: PropTypes.string, /** * Label to display in the tooltip. */ @@ -133,6 +138,7 @@ SpeedDialAction.propTypes = { SpeedDialAction.defaultProps = { delay: 0, open: false, + tooltipPosition: 'left', }; export default withStyles(styles, { name: 'MuiSpeedDialAction' })(SpeedDialAction); diff --git a/pages/lab/api/speed-dial-action.md b/pages/lab/api/speed-dial-action.md index d620ace6b7c1e5..84707a4559abe7 100644 --- a/pages/lab/api/speed-dial-action.md +++ b/pages/lab/api/speed-dial-action.md @@ -19,6 +19,7 @@ title: SpeedDialAction API | classes | object |   | Useful to extend the style applied to components. | | delay | number | 0 | Adds a transition delay, to allow a series of SpeedDialActions to be animated. | | icon * | node |   | The Icon to display in the SpeedDial Floating Action Button. | +| tooltipPosition | string | 'left' | Placement of the tooltip. | | tooltipTitle | node |   | Label to display in the tooltip. | Any other properties supplied will be spread to the root element (native element).