cdevienne/elm-orus-ui/1.0.0

Renamed to orus-io/elm-orus-ui. It is published under that name, and new versions come out there.

Versions published as cdevienne/elm-orus-ui still install under that name. 1 version of 1 come from the new location (see their notes).

Rerouted (renamed, needs approval). The GitHub user or repository was renamed. The tag is still there, at the new name. The Lamdera package server serves a copy recovered from https://github.com/orus-io/elm-orus-ui.

What we checked: The repo moved to github.com/orus-io/elm-orus-ui and tag 1.0.0 is there; its commit ad645724a38d is from 2024-11-15 10:17 UTC, after the version was published (2024-11-15 09:57 UTC); elm.json differs from 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/cdevienne/elm-orus-ui/zipball/1.0.0/

OUI.Button

A button creation API

type Button constraints msg

A button

type Type
= Elevated
| Filled
| Outlined
| Text
| SmallFAB
| MediumFAB
| LargeFAB
| ExtendedFAB
| FilledIcon
| OutlinedIcon
| Icon

A button type

type Action msg
= Disabled
| OnClick msg
| Link String
| NewTabLink String
| DownloadLink String
| DownloadAsLink String String

A button action

Constructor

new :
String
-> Button
{ needOnClickOrDisabled : ()
, hasNoIcon : ()
}
msg

Create a button with the given label

A text and an action (onClick, link or disabled) must be set before it can be rendered

The text is mandatory for icon buttons too and will be used as a 'aria-label' property.

By default, the button is of the 'Elevated' type, and its color is 'Primary'

Basic properties

-> Button { a | hasNoIcon : () } msg
-> Button { a | hasIcon : () } msg

Set the button icon

Can only be called once

color : Color -> Button a msg -> Button a msg

Set the button primary color

Actions

A button must have one and only one action that can be set with one of the following functions.

msg
-> Button { a | needOnClickOrDisabled : () } msg
-> Button { a | hasAction : () } msg

Set the button 'onClick' handler

Button { props | needOnClickOrDisabled : () } msg
-> Button { a | hasAction : () } msg

Set the button as 'disabled'

Instead of a direct action (or disabled), a button can be a link

Button types

elevatedButton : Button a msg -> Button a msg

Set the button type to 'Elevated' (default)

filledButton : Button a msg -> Button a msg

Set the button type to 'Filled'

outlinedButton : Button a msg -> Button a msg

Set the button type to 'Outlined'

textButton : Button a msg -> Button a msg

Set the button type to 'TextButton'

Button { a | hasIcon : () } msg
-> Button { a | hasIcon : () } msg

Set the button type to 'SmallFAB'

Button { a | hasIcon : () } msg
-> Button { a | hasIcon : () } msg

Set the button type to 'MediumFAB'

Button { a | hasIcon : () } msg
-> Button { a | hasIcon : () } msg

Set the button type to 'LargeFAB'

extendedFAB : Button a msg -> Button a msg

Set the button type to 'ExtendedFAB'

Button { a | hasIcon : () } msg
-> Button { a | hasIcon : () } msg

Set the button type to 'IconButton'

Button { a | hasIcon : () } msg
-> Button { a | hasIcon : () } msg

Set the button type to 'FilledIconButton'

Button { a | hasIcon : () } msg
-> Button { a | hasIcon : () } msg

Set the button type to 'OutlinedIconButton'

Internal

getText : Button c msg -> String

get the button text

getIcon : Button c msg -> Maybe Icon

get the button icon

getAction : Button c msg -> Action msg

get the button action

getColor : Button c msg -> Color

get the button color

getType : Button c msg -> Type

get the button type