NoRedInk/noredink-ui/11.1.0

NOTE: the latest version is 35.9.3

Nri.Ui.SegmentedControl.V9

type alias Option a =
{ value : a
, icon : Maybe Svg
, label : String
}
type Width
= FitContent
| FillContainer
view : NavConfig a msg -> Html msg
viewSpa : (route -> String) -> NavConfig route msg -> Html msg

Creates a segmented control that supports SPA navigation. You should always use this instead of view when building a SPA and the segmented control options correspond to routes in the SPA.

The first parameter is a function that takes a route and returns the URL of that route.

type alias SelectConfig a msg =
{ onClick : a -> msg
, options : List (Option a)
, selected : Maybe a
, width : Width
}
  • onClick : the message to produce when an option is selected (clicked) by the user
  • options: the list of options available
  • selected: if present, the value of the currently-selected option
  • width: how to size the segmented control
viewSelect : SelectConfig a msg -> Html msg

Creates just the segmented select when you need the ui element itself and not a page control

Changes from V7:

  • remove dependence on Nri.Ui.Icon.V5
  • fix icons overlowing the segmented control