intrepidshape/elm-web3-ui/2.4.0

NOTE: the latest version is 4.0.0

Web3.Ui.TradeTabs

Generic tab switcher for trade UIs (Buy / Sell / Stake, or any other named tab set). Single-select, button-based, accessible.

type TradeTab = BuyTab | SellTab | StakeTab


Web3.Ui.TradeTabs.view
    { current = model.tradeTab
    , onSelect = ChangeTradeTab
    , tabs =
        [ { id = BuyTab,   label = "Buy" }
        , { id = SellTab,  label = "Sell" }
        , { id = StakeTab, label = "Stake" }
        ]
    }

CSS classes: web3-tradetabs, web3-tradetabs__tab, web3-tradetabs__tab--active.

{ current : id
, onSelect : id -> msg
, tabs : List (Tab id)
}
-> Html msg

Render the switcher.

type alias Tab id =
{ id : id
, label : String
}

One tab definition. id is your app's tab type; label is what users see.