betagouv / elm-dsfr / BetaGouv.DSFR.Input

Création

new : { onInput : String -> msg, id : String, label : Accessibility.Html Basics.Never, value : String } -> Config msg

Crée un champ de saisie

Input.new
    { onInput = UpdateDate
    , id = "date"
    , label = text "Date"
    , value = date
    }
    |> Input.date
    |> Input.view

view : Config msg -> Accessibility.Html msg

Types de champ de saisie

textArea : Maybe Basics.Int -> Config msg -> Config msg

Définit un champ de saisie de type textarea

Input.new
    { onInput = UpdateComment
    , id = "commentaire"
    , label = text "Commentaire"
    , value = value
    }
    |> Input.textArea (Just 8)
    |> Input.withExtraAttrs [ class "w-full" ]
    |> Input.view

date : Config msg -> Config msg

email : Config msg -> Config msg

numeric : Config msg -> Config msg

decimal : Basics.Float -> Config msg -> Config msg

Définit un champ de saisie décimal

Input.new
    { onInput = UpdateCost
    , id = "cost"
    , label = text "Coût"
    , value = cost
    }
    |> Input.decimal 0.01
    |> Input.view

`Input.decimal 0.01` signifie une précision à deux décimales après la virgule.

password : Config msg -> Config msg

textDisplay : Config msg -> Config msg

text : Config msg -> Config msg

custom : String -> Config msg -> Config msg

Définit un champ de saisie personnalisé

Input.new
    { onInput = UpdatePhone
    , id = "phone"
    , label = text "Numéro de téléphone"
    , value = value
    }
    |> Input.custom "tel"
    |> Input.view

Configuration

withDisabled : Basics.Bool -> Config msg -> Config msg

withValid : Maybe (List (Accessibility.Html msg)) -> Config msg -> Config msg

withError : Maybe (List (Accessibility.Html msg)) -> Config msg -> Config msg

withHint : List (Accessibility.Html Basics.Never) -> Config msg -> Config msg

withReadonly : Basics.Bool -> Config msg -> Config msg

withType : InputType -> Config msg -> Config msg

withIcon : Maybe String -> Config msg -> Config msg

withInputAttrs : List (Accessibility.Attribute msg) -> Config msg -> Config msg

withExtraAttrs : List (Accessibility.Attribute Basics.Never) -> Config msg -> Config msg

Type


type alias Config msg =
{ mandatory : MandatoryInputConfig msg
, optional : OptionalInputConfig msg 
}