Permalink
Browse files

feat(Toolbar): Added 'container' prop, to configure where the element…

… should be inserted into
  • Loading branch information...
HHogg committed Sep 25, 2018
1 parent b4f6f32 commit 4d2c89f6fe89d671b6a177cccedca5e2e3e0712c
Showing with 7 additions and 2 deletions.
  1. +7 −2 src/Toolbar/Toolbar.js
@@ -13,6 +13,11 @@ export default class Toolbar extends Component {
static propTypes = {
/** Toolbar action components. */
children: PropTypes.node.isRequired,
/**
* An HTML element to insert the toolbar into. Defaults
* to the document.body.
*/
container: PropTypes.object,
/**
* Target is a function that is provided with a ref. Used for
* situations where the Toolbar is to be positioned around a
@@ -125,7 +130,7 @@ export default class Toolbar extends Component {
}

render() {
const { children, target, ...rest } = this.props;
const { children, container = document.body, target, ...rest } = this.props;
const { render, visible } = this.state;
const props = omit(rest, [
'targetBox',
@@ -160,7 +165,7 @@ export default class Toolbar extends Component {
</Base>
</Appear>
</div>,
document.body
container,
) }
</Fragment>
);

0 comments on commit 4d2c89f

Please sign in to comment.