fabiommendes / elm-daisy-ui / Daisy.Tab


type alias Model =
{ index : Basics.Int
, size : Basics.Int 
}

The tab state


type Msg

Opaque messages

Elm archtechture

init : Config a msg -> Model

Initial tab state.

Store this in your model.

view : Config a msg -> Model -> a -> Html msg

Render tabs from config and tab state

update : Msg -> Model -> Model

Update function

Changing and inspecting state

index : Model -> Basics.Int

Return the index of the currently selected tab.

setIndex : Basics.Int -> Model -> Model

Force selected tab to the given index

title : Config a msg -> Model -> String

Return the tab title from the currently selected tab.

Config


type alias Config a msg =
{ msg : Msg -> msg
, tabs : List ( String
, a -> Html msg ) 
}

Declare how tabs are rendered and integrated to the rest of the application

config : (Msg -> msg) -> List ( String, a -> Html msg ) -> Config a msg

Create a config object.

It is necessary to pass the message wrapper in your module and a list of pairs with (title, render) with the name of the tab and the render function for the corresponding tab.