Copyright | (c) 2018 Francisco Vallarino |
---|---|
License | BSD-3-Clause (see the LICENSE file) |
Maintainer | fjvallarino@gmail.com |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
Dropdown widget, allowing selection of a single item from a collapsable list.
Both header and list content is customizable, and so is its styling. In case
only Text
content is needed, TextDropdown
is easier
to use.
Synopsis
- data DropdownCfg s e a
- type DropdownItem a = SelectListItem a
- dropdown :: (WidgetModel s, WidgetEvent e, Traversable t, DropdownItem a) => ALens' s a -> t a -> (a -> WidgetNode s e) -> (a -> WidgetNode s e) -> WidgetNode s e
- dropdown_ :: (WidgetModel s, WidgetEvent e, Traversable t, DropdownItem a) => ALens' s a -> t a -> (a -> WidgetNode s e) -> (a -> WidgetNode s e) -> [DropdownCfg s e a] -> WidgetNode s e
- dropdownV :: (WidgetModel s, WidgetEvent e, Traversable t, DropdownItem a) => a -> (Int -> a -> e) -> t a -> (a -> WidgetNode s e) -> (a -> WidgetNode s e) -> WidgetNode s e
- dropdownV_ :: (WidgetModel s, WidgetEvent e, Traversable t, DropdownItem a) => a -> (Int -> a -> e) -> t a -> (a -> WidgetNode s e) -> (a -> WidgetNode s e) -> [DropdownCfg s e a] -> WidgetNode s e
- dropdownD_ :: (WidgetModel s, WidgetEvent e, Traversable t, DropdownItem a) => WidgetData s a -> t a -> (a -> WidgetNode s e) -> (a -> WidgetNode s e) -> [DropdownCfg s e a] -> WidgetNode s e
Configuration
data DropdownCfg s e a Source #
Configuration options for dropdown:
onFocus
: event to raise when focus is received.onFocusReq
:WidgetRequest
to generate when focus is received.onBlur
: event to raise when focus is lost.onBlurReq
:WidgetRequest
to generate when focus is lost.onChange
: event to raise when selected item changes.onChangeReq
:WidgetRequest
to generate when selected item changes.onChangeIdx
: event to raise when selected item changes. Includes index,onChangeIdxReq
:WidgetRequest
to generate when selected item changes. Includes index.maxHeight
: maximum height of the list when dropdown is expanded.itemBasicStyle
:Style
of an item in the list when not selected.itemSelectedStyle
:Style
of the selected item in the list.
Instances
type DropdownItem a = SelectListItem a Source #
Constraints for an item handled by dropdown.
Constructors
:: (WidgetModel s, WidgetEvent e, Traversable t, DropdownItem a) | |
=> ALens' s a | The lens into the model. |
-> t a | The list of selectable items. |
-> (a -> WidgetNode s e) | Function to create the header (always visible). |
-> (a -> WidgetNode s e) | Function to create the list (collapsable). |
-> WidgetNode s e | The created dropdown. |
Creates a dropdown using the given lens.
:: (WidgetModel s, WidgetEvent e, Traversable t, DropdownItem a) | |
=> ALens' s a | The lens into the model. |
-> t a | The list of selectable items. |
-> (a -> WidgetNode s e) | Function to create the header (always visible). |
-> (a -> WidgetNode s e) | Function to create the list (collapsable). |
-> [DropdownCfg s e a] | The config options. |
-> WidgetNode s e | The created dropdown. |
Creates a dropdown using the given lens. Accepts config.
:: (WidgetModel s, WidgetEvent e, Traversable t, DropdownItem a) | |
=> a | The current value. |
-> (Int -> a -> e) | The event to raise on change. |
-> t a | The list of selectable items. |
-> (a -> WidgetNode s e) | Function to create the header (always visible). |
-> (a -> WidgetNode s e) | Function to create the list (collapsable). |
-> WidgetNode s e | The created dropdown. |
Creates a dropdown using the given value and onChange
event handler.
:: (WidgetModel s, WidgetEvent e, Traversable t, DropdownItem a) | |
=> a | The current value. |
-> (Int -> a -> e) | The event to raise on change. |
-> t a | The list of selectable items. |
-> (a -> WidgetNode s e) | Function to create the header (always visible). |
-> (a -> WidgetNode s e) | Function to create the list (collapsable). |
-> [DropdownCfg s e a] | The config options. |
-> WidgetNode s e | The created dropdown. |
Creates a dropdown using the given value and onChange
event handler.
| Accepts config.
:: (WidgetModel s, WidgetEvent e, Traversable t, DropdownItem a) | |
=> WidgetData s a | The |
-> t a | The list of selectable items. |
-> (a -> WidgetNode s e) | Function to create the header (always visible). |
-> (a -> WidgetNode s e) | Function to create the list (collapsable). |
-> [DropdownCfg s e a] | The config options. |
-> WidgetNode s e | The created dropdown. |
Creates a dropdown providing a WidgetData instance and config.