I want to combine the best parts of these two similar functions:

(defn dropdown-button-list
“Returns a dropdown button component
Requires options of:
{:id …
:label …
:items [{:label …
:dispatch …}
…]}
Optionally can take options of:
{:color …
:class …
:direction …
:disabled …
:items [{:disabled …}
…]}”
[{:keys [id label color direction disabled class items] :as options}]
(ra/with-let [is-open (ra/atom false)]
[dropdown-button {:key (str id “-dropdown-button”)
:is-open @is-open
:direction (or direction “down”)
:toggle #(reset! is-open (not @is-open))
:class class}
[dropdown-toggle {:key (str id “-dropdown-toggle”)
:caret true
:color (or color “warning”)
:disabled disabled}
label]
(let [dropdown-items (->> items
(remove nil?)
(map-indexed append-dropdown-idx))]
;; README: There is an issue where if the dropdown menu is long enough, it will hug the screen / browsers
;; right side, for now just put a mr-3 to move it left a bit and make it look better.
[dropdown-menu {:key (str id “-dropdown-menu”)}
(for [{:keys [label dispatch disabled dropdown-idx]} dropdown-items]
[dropdown-item {:key (str id “-dropdown-item-” dropdown-idx)
:on-click #(rf/dispatch dispatch)
:disabled disabled}
label])])]))

(defn dropdown-button-component
“Standard dropdown menu button. Takes a config map.
See default-styles-dropdown-menu-button for an example list of things that can be changed if desired.
Required:
:items [list of dropdown items preformatted]
Recommended:
:title string
:dropdown-button {:key string} (unique, prevents duplicate menus)
Optional:
:dropdown-toggle {}
:dropdown-menu {}”
[{:keys [title dropdown-button dropdown-toggle dropdown-menu hiccup-items items]
:or {title (:title default-styles-dropdown-button)}}]
(def foo dropdown-button)
(ra/with-let [is-open (ra/atom false)
default default-styles-dropdown-button]
(fn [] [components/dropdown-button
(merge (:dropdown-button default)
dropdown-button
{:is-open @is-open
:toggle #(reset! is-open (not @is-open))})
[components/dropdown-toggle
(merge (:dropdown-toggle default) dropdown-toggle)
title]
[components/dropdown-menu
(merge (:dropdown-menu default)
dropdown-menu)
(map dropdown-item items)]])))

They are supported by the following code:

(defn dropdown-item [config]
  (let [label         (:label config)]
    [components/dropdown-item config label]))

(def default-styles-dropdown-button
  {:title            "Actions"
   :dropdown-button  {:key       (str "dropdown-" (rand-int 100))
                                 ;; If there are multiple dropdowns with the same title this leads to problems.
                                 ;; You should set this manually, but this is a small failsafe.
                      :direction "down"
                      :class     {}
                      :style     {:height ""}}
   :dropdown-toggle  {:key       "dropdown-toggle"
                      :style     {:width ""}
                      :color     "primary"
                      :caret     true}
   :dropdown-menu    {:key       "dropdown-menu"
                      :class     "dropdown-menu-right"}
   ;; These items are here just to show examples of the structure, they are not read as default options by the menu generation code
   :items            [{:key      "item-1"
                        :disabled false
                        :label    "Clickable item"}
                      {:key      "item-2"
                       :disabled true
                       :label [:div.d-flex
                               "Disabled item "
                               [:i.fas.fa-question-circle.fa-md.ml-2]]}]})

(defn- append-dropdown-idx [idx item]
  (assoc item :dropdown-idx idx))