NoRedInk/noredink-ui/7.15.0

NOTE: the latest version is 35.9.3

Nri.Ui.SegmentedControl.V7

type alias Config a msg =
{ onClick : a -> msg
, options : List (Option a)
, selected : a
, width : Width
, content : Html msg
}
  • onClick : the message to produce when an option is selected (clicked) by the user
  • options: the list of options available
  • selected: the value of the currently-selected option
  • width: how to size the segmented control
  • content: the panel content for the selected option
type alias Icon =
{ alt : String
, icon : IconType
}
type alias Option a =
{ value : a
, icon : Maybe Icon
, label : String
}
type Width
= FitContent
| FillContainer
view : Config a msg -> Html msg
viewSpa : (route -> String) -> Config 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 ToggleConfig a msg =
{ onClick : a -> msg
, options : List (Option a)
, selected : a
, width : Width
}

Same shape as Config but without the content

viewToggle : ToggleConfig a msg -> Html msg

Creates just the toggle when need the ui element itself and not a page control

Modules