Skip to content
This repository was archived by the owner on Jan 14, 2025. It is now read-only.

Commit 003221a

Browse files
dan-kwiatMatt Goo
authored andcommitted
docs(menu-surface): open state & ref errors (#412)
1 parent 7872856 commit 003221a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

packages/menu-surface/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class MyApp extends React.Component {
6262
open={this.state.open}
6363
anchorCorner={Corner.BOTTOM_LEFT}
6464
onClose={() => this.setState({open: false})}
65-
anchorElement={anchorElement}
65+
anchorElement={this.state.anchorElement}
6666
>
6767
<img
6868
style={{maxWidth: '20vw', maxHeight: '20vh'}}
@@ -85,6 +85,7 @@ import MenuSurface from '@material/react-menu-surface';
8585
class MyApp extends React.Component {
8686
state = {
8787
open: false,
88+
coordinates: null,
8889
};
8990

9091
componentDidMount() {
@@ -111,7 +112,7 @@ class MyApp extends React.Component {
111112
<MenuSurface
112113
open={this.state.open}
113114
onClose={() => this.setState({open: false, coordinates: null})}
114-
coordinates={coordinates}
115+
coordinates={this.state.coordinates}
115116
>
116117
<img
117118
style={{maxWidth: '20vw', maxHeight: '20vh'}}
@@ -134,7 +135,7 @@ anchorCorner | Corner | Sets the corner that the menu surface will be anchored t
134135
anchorElement | Element | Sets the anchor element used as an anchor for `menu-surface` positioning logic. Should contain class `.mdc-menu-surface--anchor`.
135136
anchorMargin | Object* | Sets the distance from the anchor point that the menu surface should be shown.
136137
coordinates | {x: Number, y: Number} | Sets the anchor coordinates when menu surface does not use anchorElement.
137-
open | Boolean | Opens menu surface when true.
138+
open | Boolean | Changing value will trigger open/close of the menu surface.
138139
quickOpen | Boolean | Disables the open/close animation of the menu surface, which makes the open/close instant.
139140
fixed | Boolean | Sets the menu surface to fixed positioning.
140141
onClose | Function | Callback triggered after menu surface closes.

0 commit comments

Comments
 (0)