Skip to content

Commit

Permalink
feat(Toolbar): Added 'container' prop, to configure where the element…
Browse files Browse the repository at this point in the history
… should be inserted into
  • Loading branch information
HHogg committed Sep 25, 2018
1 parent b4f6f32 commit 4d2c89f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Toolbar/Toolbar.js
Expand Up @@ -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
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -160,7 +165,7 @@ export default class Toolbar extends Component {
</Base>
</Appear>
</div>,
document.body
container,
) }
</Fragment>
);
Expand Down

0 comments on commit 4d2c89f

Please sign in to comment.