            [:input {:type "text"
                     :on-change handle-input-change
                     :on-focus #(swap! state assoc :focused true)
-                    :on-blur #(js/setTimeout (fn [] (swap! state assoc :focused false :current-text nil)) 100)
                     :value (or (:current-text @state)
-                               (label-fn value))}]
+                               (match-fn value))}]
 
            (when (and (:focused @state) (not (empty? (:suggestions @state))))
              [:div.suggestions
               (for [i (:suggestions @state)] ^{:key (pr-str (value-fn i))}
-                [:div.option {:on-click (fn []
-                                         (when on-change
-                                           (on-change (value-fn i)))
-                                         (swap! state assoc :current-text nil))}
+                [:div.option {:on-click #(do (when on-change (on-change (value-fn i)))
+                                             (close))}
                  (label-fn i)])])]))})))

  (let [state (r/atom {:current-text nil
                       :focused false
                       :suggestions []})

        on-change-ch (chan)
        handle-input-change
        (fn [event]

          timer (timeout ms)
          [new-val ch] (alts! [in timer])]
      (condp = ch
        timer (do (swap! state assoc :suggestions  (<! (suggest-fn val)))
                  (recur nil))
        in (when new-val (recur new-val))))))

