Skip to content

Commit

Permalink
[docs] Add TS demo for MenuPopupState (#18998)
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon authored Dec 27, 2019
1 parent 0cb1c04 commit d57c223
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions docs/src/pages/components/menus/MenuPopupState.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import React from 'react';
import Button from '@material-ui/core/Button';
import Menu from '@material-ui/core/Menu';
import MenuItem from '@material-ui/core/MenuItem';
import PopupState, { bindTrigger, bindMenu } from 'material-ui-popup-state';

export default function MenuPopupState() {
return (
<PopupState variant="popover" popupId="demo-popup-menu">
{popupState => (
<React.Fragment>
<Button variant="contained" color="primary" {...bindTrigger(popupState)}>
Open Menu
</Button>
<Menu {...bindMenu(popupState)}>
<MenuItem onClick={popupState.close}>Cake</MenuItem>
<MenuItem onClick={popupState.close}>Death</MenuItem>
</Menu>
</React.Fragment>
)}
</PopupState>
);
}

0 comments on commit d57c223

Please sign in to comment.