primait / pyxis-components / Prima.Pyxis.Button

Configuration


type Config msg

Represent the configuration of the Button.

Configuration Methods

callOut : String -> Config msg

Create a button with a callOut visual weight and a default size.

--

import Prima.Pyxis.Button as Button

type Msg =
    Clicked

...

myBtn : Button.Config Msg
myBtn =
    Button.primary "Click me!"
        |> Button.withOnClick Clicked

primary : String -> Config msg

Create a button with a Primary visual weight and a default size.

secondary : String -> Config msg

Create a button with a Secondary visual weight and a default size.

tertiary : String -> Config msg

Create a button with a Tertiary visual weight and a default size.

loading : String -> Config msg

Create a button with a Loading visual weight and a default size.

primaryAlt : String -> Config msg

Create a button with a Primary Alt visual weight and a default size.

secondaryAlt : String -> Config msg

Create a button with a Secondary Alt visual weight and a default size.

tertiaryAlt : String -> Config msg

Create a button with a Tertiary Alt visual weight and a default size.

Rendering

render : Config msg -> Html msg

Renders the button by receiving it's configuration.

--

import Prima.Pyxis.Button as Button

type Msg =
    Clicked

...

myBtn : Button.Config Msg
myBtn =
    Button.callOut "Click me!"
        |> Button.withDisabled False
        |> Button.withOnClick Clicked

...

view : Html Msg
view =
    Button.render myBtn

Options

withAttribute : Html.Attribute msg -> Config msg -> Config msg

Adds a generic attribute to the Button.

withClass : String -> Config msg -> Config msg

Adds classes to the classes of the Button.

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

Adds a disabled Html.Attribute to the Button.

withIcon : String -> Config msg -> Config msg

Adds an icon to the Button.

withId : String -> Config msg -> Config msg

Adds an id Html.Attribute to the Button.

withMediumSize : Config msg -> Config msg

Sets a size of Medium to the Button.

withSmallSize : Config msg -> Config msg

Sets a size of Small to the Button.

withTinySize : Config msg -> Config msg

Sets a size of Tiny to the Button.

withTabIndex : Basics.Int -> Config msg -> Config msg

Adds a tabIndex Html.Attribute to the Button.

withTargetBlank : Config msg -> Config msg

Adds a target Html.Attribute to the Button.

withTargetParent : Config msg -> Config msg

Adds a target Html.Attribute to the Button.

withTargetSelf : Config msg -> Config msg

Adds a target Html.Attribute to the Button.

withTargetTop : Config msg -> Config msg

Adds a target Html.Attribute to the Button.

withTitle : String -> Config msg -> Config msg

Adds a title Html.Attribute to the Button.

withTypeButton : Config msg -> Config msg

Adds a type Html.Attribute to the Button.

withTypeReset : Config msg -> Config msg

Adds a type Html.Attribute to the Button.

withTypeSubmit : Config msg -> Config msg

Adds a type Html.Attribute to the Button.

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

Sets a emphasis of Loading to the Button.

Event Options

withOnClick : msg -> Config msg -> Config msg

Adds an onClick Html.Event to the Button.

withOnMouseDown : msg -> Config msg -> Config msg

Adds an onMouseDown Html.Event to the Button.

withOnMouseUp : msg -> Config msg -> Config msg

Adds an onMouseUp Html.Event to the Button.

withOnMouseEnter : msg -> Config msg -> Config msg

Adds an onMouseEnter Html.Event to the Button.

withOnMouseLeave : msg -> Config msg -> Config msg

Adds an onMouseLeave Html.Event to the Button.

withOnMouseOver : msg -> Config msg -> Config msg

Adds an onMouseOver Html.Event to the Button.

withOnMouseOut : msg -> Config msg -> Config msg

Adds an onMouseOut Html.Event to the Button.