primait/pyxis-components/4.1.0

NOTE: the latest version is 9.0.3

Prima.Pyxis.Button

Allows to create a Button using predefined Html syntax.

Configuration

type Config msg

Represents the configuration of the button.

Represents the visual weight of the button.

type Scheme
= Brand
| BrandDark

Represents the color scheme used to render the button.

Configuration Helpers

callOut : Scheme -> String -> msg -> Config msg

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

--


import Prima.Pyxis.Button as Button


type Msg =
    Clicked


...


myBtn : Button.Config Msg
myBtn =
    Button.callOut Button.brand "Click me!" Clicked isDisabled
callOutSmall : Scheme -> String -> msg -> Config msg

Creates a button with a CallOut visual weight and a small size.

primary : Scheme -> String -> msg -> Config msg

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

primarySmall : Scheme -> String -> msg -> Config msg

Creates a button with a Primary visual weight and a small size.

secondary : Scheme -> String -> msg -> Config msg

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

secondarySmall : Scheme -> String -> msg -> Config msg

Creates a button with a Secondary visual weight and a small size.

tertiary : Scheme -> String -> msg -> Config msg

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

tertiarySmall : Scheme -> String -> msg -> Config msg

Creates a button with a Tertiary visual weight and a small size.

Rendering

render : Bool -> 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 Button.Brand "Click me!" Clicked isDisabled


...


view : Html Msg
view =
    let
        isEnabled =
            True
    in
    Button.render isEnabled myBtn
group : List ( Bool, Config msg ) -> Html msg

Creates a button wrapper which can hold a set of Buttons.

--


import Prima.Pyxis.Button as Button


type Msg =
    Clicked


...


ctaBtn : Button.Config Msg
ctaBtn =
    Button.callOut Button.brand "Click me!" Clicked isDisabled




primaryBtn : Button.Config Msg
primaryBtn =
    Button.primary Button.brand "Click me!" Clicked isDisabled


...


view : Html Msg
view =
    let
        isCtaBtnEnabled =
            True


        isPrimaryBtnEnabled =
            True
    in
    Button.group [(isCtaBtnEnabled, ctaBtn), (isPrimaryBtnEnabled, primaryBtn)]