supermacro / elm-antd / Ant.Button

Button component


type Button msg

Represents a button component

Customizing the Button

button : String -> Button msg

Create a Button component.

button "Click Me!"
    |> toHtml

onClick : msg -> Button msg -> Button msg

Make your button emit messages. By default, clicking a button does nothing.

button "submit"
    |> onClick FinalCheckoutFormSubmitted
    |> toHtml


type ButtonType
    = Primary
    | Default
    | Dashed
    | Text
    | Link

The type of the button

withType : ButtonType -> Button msg -> Button msg

Change the default type of the Button

button "submit"
    |> withType Dashed
    |> toHtml

withIcon : Ant.Icons.Icon msg -> Button msg -> Button msg

Add an icon to the button

button "Search"
    |> withIcon searchOutlined
    |> toHtml


type ButtonSize
    = Large
    | DefaultSize
    | Small

Determines the size of the button

disabled : Basics.Bool -> Button msg -> Button msg

Make the button disabled. If you have a onClick event registered, it will not be fired.

button "You can't click this"
    |> onClick Logout
    |> disabled True
    |> toHtml

withHtmlType : HtmlButtonType -> Button msg -> Button msg

Specify the "type" attribute of the button.


type HtmlButtonType
    = Button_
    | Reset
    | Submit

The "type" attribute of a HTML button as defined in the button spec:

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button

toHtml : Button msg -> Html msg

Turn your Button into Html msg