Skip to content

Commit

Permalink
Allow programmatic opening and closing DropDownMenu
Browse files Browse the repository at this point in the history
  • Loading branch information
MrLeebo committed Oct 21, 2015
1 parent ca207c4 commit c3547b3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions docs/src/app/components/pages/components/drop-down-menu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@ export default class DropDownMenuPage extends React.Component {
header: 'default: false',
desc: 'Disables the menu.',
},
{
name: 'openImmediately',
type: 'bool',
header: 'default: false',
desc: 'Set to true to have the DropDownMenu automatically open on mount.',
},
],
},
{
Expand Down
3 changes: 2 additions & 1 deletion src/drop-down-menu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const DropDownMenu = React.createClass({
iconStyle:React.PropTypes.object,
labelStyle:React.PropTypes.object,
selectedIndex: React.PropTypes.number,
openImmediately: React.PropTypes.bool,
},

getDefaultProps() {
Expand All @@ -59,7 +60,7 @@ const DropDownMenu = React.createClass({

getInitialState() {
return {
open: false,
open: this.props.openImmediately,
selectedIndex: this._isControlled() ? null : (this.props.selectedIndex || 0),
muiTheme: this.context.muiTheme ? this.context.muiTheme : ThemeManager.getMuiTheme(DefaultRawTheme),
};
Expand Down

0 comments on commit c3547b3

Please sign in to comment.