avarda-ab/avarda-ui/1.0.0

NOTE: the latest version is 5.0.3

Rerouted (retagged, needs approval). The tag now points at a different commit than when this version was published. The Lamdera package server serves a copy recovered from https://github.com/avarda-ab/avarda-ui.

What we checked: Tag 1.0.0 is still on github.com/avarda-ab/avarda-ui; its commit 638a80847214 is from 2025-09-15 07:28 UTC, after the version was published (2025-09-12 14:47 UTC); elm.json is byte-identical to package.elm-lang.org's; the exposed modules match docs.json; the zip's SHA-1 is not the published one and nothing else confirms its contents.

We could not verify this copy against what was published, so the Lamdera compiler asks before using it (y/n). Without a terminal, as in CI, it stops with an error unless approved:

  • lamdera make --auto-approve-package-rerouting approves rerouted versions for that run,
  • LAMDERA_AUTO_APPROVE_PACKAGE_REROUTING=1 does the same for every run in that environment,
  • LAMDERA_CACHE=off skips the Lamdera package server altogether: packages come from package.elm-lang.org and GitHub only, as with elm, and a rerouted version then fails to download.

Details · package.elm-lang.org's zip: https://github.com/avarda-ab/avarda-ui/zipball/1.0.0/

AvardaUi.Input

Input field component for Avarda design system.

This module provides a styled input with support for floating labels, hints, error messages, and optional left/right children. It uses the builder pattern:

  1. Start with new to create a base input.
  2. Chain configuration functions like withPlaceholder or withIsRequired.
  3. Finish with view to render it.

Creating an Input

new :
String
-> { value : String
, msg : String -> msg
, label : String
}
-> Input msg

Create a new input with required fields: id, value, msg, and label.

This gives you a base input that you can configure further with withX functions.

Input.new "username"
    { value = model.username
    , msg = UsernameChanged
    , label = "Username"
    }
view : Input msg -> Html msg

Render the configured input as HTML.

Always call this after you’ve built up the input with new and chained settings.

Input.new "username" {...}
    |> Input.withPlaceholder "Enter username"
    |> Input.withIsRequired True
    |> Input.view

Configuration

withPlaceholder : String -> Input msg -> Input msg

Add a placeholder to the input. Chain after new.

Input.new "username" {...}
    |> Input.withPlaceholder "Enter username"
withIsRequired : Bool -> Input msg -> Input msg

Mark the input as required. This adds a * to the label and sets required=true.

Input.new "username" {...}
    |> Input.withIsRequired True
withIsDisabled : Bool -> Input msg -> Input msg

Disable the input. Visually dims and prevents typing.

Input.new "username" {...}
    |> Input.withIsDisabled True
withInputType : String -> Input msg -> Input msg

Change the input type (e.g. "text", "password", "email").

Input.new "password" {...}
    |> Input.withInputType "password"
withMaxLength : Int -> Input msg -> Input msg

Limit the maximum number of characters.

Input.new "username" {...}
    |> Input.withMaxLength 20
withBorderRadius : Float -> Input msg -> Input msg

Adjust the border radius of the input box.

Input.new "username" {...}
    |> Input.withBorderRadius 12
withAutocomplete : String -> Input msg -> Input msg

Enable autocomplete with a given string like "username" or "off".

Input.new "username" {...}
    |> Input.withAutocomplete "username"
withAttributes : List (Attribute msg) -> Input msg -> Input msg

Attach additional HTML attributes to the underlying <input /> element. For example name or data-* attributes.

Input.new "username" {...}
    |> Input.withAttributes [ Attributes.name "username" ]
withAdditionalWrapperStyles : List Style -> Input msg -> Input msg

Add custom CSS styles to the outer wrapper element.

Input.new "username" {...}
    |> Input.withAdditionalWrapperStyles [ Css.marginTop (Css.px 16) ]
withOnKeyDown : List ( KeyboardKey, msg ) -> Input msg -> Input msg

Listen for key presses and map them to messages. Useful for handling Enter/Escape in forms.

Input.new "username" {...}
    |> Input.withOnKeyDown [ ( KeyPressUtil.Enter, Submit ) ]

Validation and Messaging

withMaybeError : Maybe String -> Input msg -> Input msg

Show an error message and mark the input invalid. Replaces any active hint text.

Input.new "username" {...}
    |> Input.withMaybeError (Just "This field is required")
withHint : String -> Input msg -> Input msg

Add a hint text below the input (shown when there is no error).

Input.new "username" {...}
    |> Input.withHint "Must be at least 8 characters"

Children

withLeftChild : Html msg -> Input msg -> Input msg

Add a left-side child element, e.g. an icon.

Input.new "username" {...}
    |> Input.withLeftChild (Icons.user [])
withRightChild : Html msg -> Input msg -> Input msg

Add a right-side child element, e.g. a clear button.

Input.new "username" {...}
    |> Input.withRightChild (Icons.clear [ onClick Clear ])