From d68e10d28112cf8cdd8bd722bcf350826f2221ad Mon Sep 17 00:00:00 2001 From: Yiran Mao Date: Mon, 30 Jan 2017 15:23:58 -0500 Subject: [PATCH] docs(menu): Add foundation API methods to README (#230) Closes #221 [ci skip] --- packages/mdc-menu/README.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/packages/mdc-menu/README.md b/packages/mdc-menu/README.md index 12a7ff1c328..9f61031d2bc 100644 --- a/packages/mdc-menu/README.md +++ b/packages/mdc-menu/README.md @@ -180,7 +180,7 @@ const MDCSimpleMenuFoundation = mdc.Menu.MDCSimpleMenuFoundation; #### Automatic Instantiation If you do not care about retaining the component instance for the simple menu, simply call `attachTo()` and pass it a -DOM element. +DOM element. ```javascript mdc.MDCSimpleMenu.attachTo(document.querySelector('.mdc-simple-menu')); @@ -245,3 +245,17 @@ The adapter for temporary drawers must provide the following functions, with cor | `isRtl() => boolean` | Returns boolean indicating whether the current environment is RTL. | | `setTransformOrigin(value: string) => void` | Sets the transform origin for the menu element. | | `setPosition(position: { top: string, right: string, bottom: string, left: string }) => void` | Sets the position of the menu element. | + +### The full foundation API + +#### MDCSimpleMenuFoundation.open({focusIndex: number} = {}) => void + +Opens the menu. Takes an options object containing a `focusIndex` property that specifies the index of the menu item to be focused. If the options object or `focusIndex` is omitted, no menu item will be focused. + +#### MDCSimpleMenuFoundation.close() => void + +Closes the menu. + +#### MDCSimpleMenuFoundation.isOpen() => boolean + +Returns whether or not the menu is open.