 
     hide: ->
         @_hide()
-        @props.onCancel()
+        @state.onCancel?()
 
     render: ->
         return null unless @state.show
 
-        buttons = for button in @props.buttons
+        buttons = for button in @state.buttons
             if _.isString(button) then button = {title: button}
             button.eventKey ||= (button.key or button.title).toLowerCase()
             <BS.Button key={button.title}
                 bsStyle={button.style || 'default'} className={name}
                 onClick={_.partial(@onButton, button)}>{button.title}</BS.Button>
 
-        cls = _.classnames('lanes-modal', @props.className, @context.uistate?.layout_size)
-        Body = @props.body
-        <BS.Modal.Dialog className={cls} bsSize={@props.size} onHide={@_hide}>
+        cls = _.classnames('lanes-modal', @state.className, @context.uistate?.layout_size)
+        Body = @state.body
+        <BS.Modal.Dialog className={cls} bsSize={@state.size} onHide={@_hide}>
             <BS.Modal.Header>
-                <BS.Modal.Title>{@props.title}</BS.Modal.Title>
+                <BS.Modal.Title>{@state.title}</BS.Modal.Title>
             </BS.Modal.Header>
 
             <BS.Modal.Body>


    onButton: (btn) ->
        @selected = btn
        if btn.eventKey is 'ok'
            @props.onOk?(this)
        else
            @props.onCancel?(this)

    componentWillReceiveProps: (nextProps) ->
        @setState(show: nextProps.show) if nextProps.show?

    _hide: ->
        @context.viewport.modalProps.show = false

        body:      React.PropTypes.func
        show:      React.PropTypes.bool
        buttons:   React.PropTypes.array
        autoHide:  React.PropTypes.bool
        className: React.PropTypes.string
        size:      React.PropTypes.string

