diff --git a/src/SemanticUI/Modules/Dropdown/Select.elm b/src/SemanticUI/Modules/Dropdown/Select.elm index 1fc06ef..86082c6 100644 --- a/src/SemanticUI/Modules/Dropdown/Select.elm +++ b/src/SemanticUI/Modules/Dropdown/Select.elm @@ -57,6 +57,7 @@ type Variation msg | Button (Button.Config msg) | Inline | Selection { compact : Bool } + | MenuItem variationClassList : Variation msg -> List ( String, Bool ) @@ -74,6 +75,9 @@ variationClassList variation = Selection { compact } -> [ ( "compact", compact ), ( "selection", True ) ] + MenuItem -> + [ ( "inline", True ), ( "item", True ) ] + {-| Most general configuration that applies any `Select`. diff --git a/src/SemanticUI/Modules/Dropdown/Selection.elm b/src/SemanticUI/Modules/Dropdown/Selection.elm index 10600d7..b23339c 100644 --- a/src/SemanticUI/Modules/Dropdown/Selection.elm +++ b/src/SemanticUI/Modules/Dropdown/Selection.elm @@ -11,6 +11,7 @@ module SemanticUI.Modules.Dropdown.Selection exposing , inline , label , linkItem + , menuItem , scrolling , selection , single @@ -345,6 +346,29 @@ inline config = , caret = True } +{-| A single selection dropdown component that can be used as a menu item. +-} +menuItem : + { config + | value : selection + , drawerState : Drawer.State + , identifier : String + , onToggle : Drawer.State -> msg + , onSelect : option -> msg + , isSelected : option -> Bool + } + -> Selection msg option selection +menuItem config = + let + (Selection singleConfig) = + single config + in + Selection + { singleConfig + | variation = Select.MenuItem + , caret = True + } + toHtml : { builder | optionLabel : option -> Html msg, options : List option } -> Selection msg option selection -> Html msg toHtml { optionLabel, options } selectionControl =