 
     onButton: (btn) ->
         @selected = btn
+        @_hide() if @state.autoHide
         if btn.eventKey is 'ok'
-            @props.onOk?(this)
+            @state.onOk?(this)
         else
-            @props.onCancel?(this)
+            @state.onCancel?(this)
 
     componentWillReceiveProps: (nextProps) ->
-        @setState(show: nextProps.show) if nextProps.show?
+        @replaceState(nextProps)
 
     _hide: ->
         @context.viewport.modalProps.show = false

        uistate:  Lanes.PropTypes.State

    getDefaultProps: ->
        size: 'large'
        buttons: [
            { title: 'Cancel' }
            { title: 'OK', style: 'primary' }


    hide: ->
        @_hide()
        @state.onCancel?()

    render: ->
        return null unless @state.show

        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', @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>{@state.title}</BS.Modal.Title>
            </BS.Modal.Header>

            <BS.Modal.Body>
