@rmwc/menu
Advanced tools
Comparing version 8.0.5 to 8.0.6
@@ -49,2 +49,11 @@ "use strict"; | ||
}), | ||
react_1.default.createElement(_doc_utils_1.DocsExample, null, function Example() { | ||
var _a = tslib_1.__read(react_1.default.useState(false), 2), open = _a[0], setOpen = _a[1]; | ||
return (react_1.default.createElement(_1.MenuSurfaceAnchor, null, | ||
react_1.default.createElement(_1.Menu, { open: open, onSelect: function (evt) { return console.log(evt.detail.index); }, onClose: function (evt) { return setOpen(false); } }, | ||
react_1.default.createElement(_1.MenuItem, null, "Item One"), | ||
react_1.default.createElement(_1.MenuItem, { disabled: true }, "Item Two (disabled)"), | ||
react_1.default.createElement(_1.MenuItem, null, "Item Three")), | ||
react_1.default.createElement(button_1.Button, { raised: true, onClick: function () { return setOpen(!open); } }, "Menu"))); | ||
}), | ||
react_1.default.createElement(_doc_utils_1.DocsSubtitle, null, "Simplified usage"), | ||
@@ -51,0 +60,0 @@ react_1.default.createElement(_doc_utils_1.DocsP, null, "RMWC provides a convenience `SimpleMenu` component that takes a handle as a prop, and manages the open state for you."), |
@@ -46,2 +46,11 @@ import { __read } from "tslib"; | ||
}), | ||
React.createElement(DocsExample, null, function Example() { | ||
var _a = __read(React.useState(false), 2), open = _a[0], setOpen = _a[1]; | ||
return (React.createElement(MenuSurfaceAnchor, null, | ||
React.createElement(Menu, { open: open, onSelect: function (evt) { return console.log(evt.detail.index); }, onClose: function (evt) { return setOpen(false); } }, | ||
React.createElement(MenuItem, null, "Item One"), | ||
React.createElement(MenuItem, { disabled: true }, "Item Two (disabled)"), | ||
React.createElement(MenuItem, null, "Item Three")), | ||
React.createElement(Button, { raised: true, onClick: function () { return setOpen(!open); } }, "Menu"))); | ||
}), | ||
React.createElement(DocsSubtitle, null, "Simplified usage"), | ||
@@ -48,0 +57,0 @@ React.createElement(DocsP, null, "RMWC provides a convenience `SimpleMenu` component that takes a handle as a prop, and manages the open state for you."), |
{ | ||
"name": "@rmwc/menu", | ||
"version": "8.0.5", | ||
"version": "8.0.6", | ||
"description": "RMWC Menu component", | ||
@@ -41,7 +41,7 @@ "main": "dist/index.js", | ||
"@material/menu-surface": "^8.0.0", | ||
"@rmwc/base": "^8.0.5", | ||
"@rmwc/list": "^8.0.5", | ||
"@rmwc/types": "^8.0.5" | ||
"@rmwc/base": "^8.0.6", | ||
"@rmwc/list": "^8.0.6", | ||
"@rmwc/types": "^8.0.6" | ||
}, | ||
"gitHead": "d9befec0e3b258864b71686eecd16c16feb43cf1" | ||
} |
@@ -83,2 +83,26 @@ # Menus | ||
```jsx | ||
function Example() { | ||
const [open, setOpen] = React.useState(false); | ||
return ( | ||
<MenuSurfaceAnchor> | ||
<Menu | ||
open={open} | ||
onSelect={(evt) => console.log(evt.detail.index)} | ||
onClose={(evt) => setOpen(false)} | ||
> | ||
<MenuItem>Item One</MenuItem> | ||
<MenuItem disabled>Item Two (disabled)</MenuItem> | ||
<MenuItem>Item Three</MenuItem> | ||
</Menu> | ||
<Button raised onClick={() => setOpen(!open)}> | ||
Menu | ||
</Button> | ||
</MenuSurfaceAnchor> | ||
); | ||
} | ||
``` | ||
## Simplified usage | ||
@@ -85,0 +109,0 @@ |
Sorry, the diff of this file is not supported yet
109047
1811
302
Updated@rmwc/base@^8.0.6
Updated@rmwc/list@^8.0.6
Updated@rmwc/types@^8.0.6