betagouv/elm-dsfr/5.1.0

NOTE: the latest version is 5.2.0

BetaGouv.DSFR.Checkbox

Case à cocher

{ checked : Maybe Bool
, onChecked : Bool -> msg
, id : String
, label : Html Never
, value : String
}
-> Config msg

Crée une checkbox

Checkbox.single
    { checked = Just True
    , onChecked = ToggleSelection
    , id = "id"
    , label = "label"
    , value = "value"
    }
    |> Checkbox.viewSingle
viewSingle : Config msg -> Html msg

Affiche une checkbox

Configuration

singleWithDisabled : Bool -> Config msg -> Config msg
singleWithError : Maybe String -> Config msg -> Config msg
singleWithHint : Maybe String -> Config msg -> Config msg
singleWithSuccess : Maybe String -> Config msg -> Config msg

Groupe

Création

{ id : String
, legend : Html msg
, options : List data
, checked : List data
, onChecked : data -> Bool -> msg
, toId : data -> String
, toLabel : data -> Html Never
, toValue : data -> String
}
-> GroupConfig msg data

Crée un groupe de case à cocher

Checkbox.group
    { id = "group-id"
    , legend = text "Légende du groupe"
    , options = options
    , checked = checkedValues
    , onChecked = ClickOption
    , toId = optionToId
    , toLabel = optionToLabel >> text
    , toValue = optionToValue
    }
    |> Checkbox.inline
    |> Checkbox.viewGroup
viewGroup : GroupConfig msg data -> Html msg

Affiche le groupe

Orientation

inline : GroupConfig msg data -> GroupConfig msg data
stacked : GroupConfig msg data -> GroupConfig msg data

Configuration

groupWithDisabled : Bool -> GroupConfig msg data -> GroupConfig msg data
groupWithError : Maybe String -> GroupConfig msg data -> GroupConfig msg data
List (Attribute Never)
-> GroupConfig msg data
-> GroupConfig msg data
groupWithHint : Maybe String -> GroupConfig msg data -> GroupConfig msg data
groupWithSuccess : Maybe String -> GroupConfig msg data -> GroupConfig msg data
groupWithToDisabled : (data -> Bool) -> GroupConfig msg data -> GroupConfig msg data
(data -> Maybe String)
-> GroupConfig msg data
-> GroupConfig msg data
(data -> Maybe String)
-> GroupConfig msg data
-> GroupConfig msg data
(data -> Maybe String)
-> GroupConfig msg data
-> GroupConfig msg data

Type

type alias Config msg =
( MandatoryConfig msg, OptionalConfig )
type alias GroupConfig msg data =
( MandatoryGroupConfig msg data, OptionalGroupConfig data )