lenards / elm-ui-patternfly / PF4.Accordion

An expandable component that fills the role of an accordian

Definition


type Accordion msg

Opaque Accordion element that can produce msg messages


type AccordionItem msg

Opaque AccordionItem element that can produce msg messages

Constructor functions

accordion : (Msg -> msg) -> List ( String, Element msg ) -> Accordion msg

Constructs an accordian given a list of (title, content) and a message mapper function.

The msgMapper needs to take a PF4.Accordian.Msg and transform it into to the msg of your Elm application.

accordionItem : { title : String, content : Element msg } -> AccordionItem msg

Constructs an accordion item given a title and an Element msg as content

defaultState : State

Constructs a default state with the default behavior

The default behavior is "Single Expand".

Only a single accordion can be open at a given time.

singleExpandState : State

Constructs a state with behavior of "Single Expand"

Only a single accordion can be open at a given time.

multipleExpandState : State

Constructs a state with behavior of "Multiple Expand"

Each accordion item clicked on will be opened. An open accordion item clicked on will close.

Handling lifecycle of element


type alias State =
Behavior

Opaque State representation of the Accordion.

To create a State, use one of the provided


type Msg

Internal Accordion.Msg type for handling statefulness

update : Msg -> State -> State

Handles updating the state given the Msg

Rendering stateful element

toMarkupFor : State -> Accordion msg -> Element msg

Using the state and component's options to render as an Element msg

Stateful PF4 components will have a toMarkupFor, as an "markup for a particular state", instead of the toMarkup used for stateless components.