Elm library for the Bulma front-end framework

  • By Taylor Sarrafian
  • Last update: Oct 25, 2022
  • Comments: 12

Elm-Bulma is a simple and beautiful front-end library.

Documentation

Getting Started

  1. Make a new project: mkdir bulma-example && cd bulma-example.
  2. Install the package: elm package install --yes surprisetalk/elm-bulma.
  3. Create a new file Example.elm and copy this example file or the code below.
  4. Start elm reactor and navigate to http://localhost:8000/Example.elm.
module Example exposing (..)

import Browser
import Bulma.CDN exposing (..)
import Bulma.Modifiers exposing (..)
import Bulma.Elements exposing (..)
import Bulma.Columns exposing (..)
import Bulma.Layout exposing (..)
import Html exposing ( Html, main_, text )

type alias Model = {}

main : Program () Model Msg
main
  = Browser.sandbox
    { init = {}
    , view = view
    , update = \msg -> \model -> model
    }

view : Model -> Html msg
view model 
  = main_ []
    [ stylesheet
    , exampleHero
    , exampleColumns
    ]

exampleHero : Html msg
exampleHero 
  = hero { heroModifiers | size = Medium, color = Primary } []
    [ heroBody []
      [ container []
          [ title H1 [] [ text "Hero Title" ]
          , title H2 [] [ text "Hero Subtitle" ]
          ]
      ]
    ]

exampleColumns : Html msg
exampleColumns 
  = section NotSpaced []
    [ container []
      [ columns columnsModifiers []
        [ column columnModifiers [] [ text "First Column" ]
        , column columnModifiers [] [ text "Second Column" ]
        , column columnModifiers [] [ text "Third Column" ]
        ]
      ]
    ]

Contributions

Friends

Github

https://github.com/surprisetalk/elm-bulma

Comments(12)

  • 1

    Remove `elm-bulma-classes` dependency

    Unfortunately, elm-bulma-classes is no longer being maintained. I'm thinking that we should make an equivalent, either in this package or a separate one. We're open to suggestions!

  • 2

    Why is there no `Width12` in Width type?

    Hi Currently, Width type has Auto , Width1 ~ Width11 . However, Bulma supports is-12 . Why is there no Width12 in Width type? Please tell me if there is a workaround you do not need.

  • 3

    Can we get the navbar added

    Spec is here http://bulma.io/documentation/components/navbar/

    Would be great to have this added. I'd create a PR but I'm very new to Bulma.

    If you like I can open a PR with my guess at what needs to happen.

    Thanks

  • 4

    Form.controlSelect and Small size

    I wrote like below.

    controlSelect { controlSelectModifiers | size = Small } [] []
                  [ option [] [ text "Dropdown" ]
                  ]
    

    It generate:

    <p class="control">
      <span class="select">
        <select class="is-small   ">
          <option>Dropdown</option>
        </select>
      </span>
    </p>
    

    But should be:

    <p class="control">
      <span class="select is-small">
        <select>
          <option>Dropdown</option>
        </select>
      </span>
    </p>
    
  • 5

    Fix package documentation for connectedFields

    In the Elm package documentation, the example code for the connectedFields function specifies fields rather than connectedFields.

    Currently:

    myFields : Html msg
    myFields
      = fields Centered []
        [ controlInput myControlInputModifiers [] [] [] 
        , control myControlModifiers []
          [ button myButtonModifiers [] []
          ]
        ]
    

    Should be:

    myFields : Html msg
    myFields
      = connectedFields Centered []
        [ controlInput myControlInputModifiers [] [] [] 
        , control myControlModifiers []
          [ button myButtonModifiers [] []
          ]
        ]
    
  • 6

    Fix navbarBurger tag from to
    avoiding page reload.

  • 7

    replace

    with

    for form control

    The Bulma website uses div tags for controls , not p tags.

    We should do the same. This would remove the big spacing between label and input because of the p tag.

  • 8

    Package documentation needs to be updated?

    The record field name and type of gapless in ColumnsModifiers needs to be updated. https://package.elm-lang.org/packages/surprisetalk/elm-bulma/latest/Bulma-Columns#columnsModifiers

    I think the following is correct for v6.1.4:

    type ColumnsModifiers =
      { multiline : Bool
      , gap : Gap  -- not gapless : Bool
      , display : Display
      , centered : Bool
      }
    

    Thanks in advance.

  • 9

    Example in README.md doesn't work

    hey there ! beautiful project <3

    In the read me you put this code

    module Example exposing (..)
    
    import Browser
    import Bulma.CDN exposing (..)
    import Bulma.Modifiers exposing (..)
    import Bulma.Elements exposing (..)
    import Bulma.Columns exposing (..)
    import Bulma.Layout exposing (..)
    import Html exposing ( Html, main_, text )
    
    type alias Model = {}
    
    main : Program () Model Msg
    main
      = Browser.sandbox
        { init = {}
        , view = view
        , update = \msg -> \model -> model
        }
    
    view : Model -> Html msg
    view model 
      = main_ []
        [ stylesheet
        , exampleHero
        , exampleColumns
        ]
    
    exampleHero : Html msg
    exampleHero 
      = hero { heroModifiers | size = Medium, color = Primary } []
        [ heroBody []
          [ container []
              [ title H1 [] [ text "Hero Title" ]
              , title H2 [] [ text "Hero Subtitle" ]
              ]
          ]
        ]
    
    exampleColumns : Html msg
    exampleColumns 
      = section NotSpaced []
        [ container []
          [ columns columnsModifiers []
            [ column columnModifiers [] [ text "First Column" ]
            , column columnModifiers [] [ text "Second Column" ]
            , column columnModifiers [] [ text "Third Column" ]
            ]
          ]
        ]
    

    elm complains that at line 13 main : Program () Model Msg Msg is not defined Im a beginner at elm so i can't help ^^'

  • 10

    Fixed button documention

    I fixed the buttons and connectedButtons documentation (sample in comments). The button component was missing the second argument: List (Attribute msg).

  • 11

    Reason for anchors as buttons

    I noticed it was very intentional in d3cf31450cc52da57608b35f560a2ea0e88a97bd, but why did this happen? Obviously you had something in mind so I might just be missing something.

    Mainly, I keep encountering #17 which is easily work-around-able, but with a button tag it wouldn't even be an issue in a lot of cases.

    Thanks for the great work! I love the library so far.

  • 12

    Example code in documentation for navbarBurger contains a syntax error

    This code is missing the prototype and parameter for the isMenuOpen Boolean

    myNavbarBurger : Html Msg
    myNavbarBurger 
      = navbarBurger isMenuOpen []
        [ span [] []
        , span [] []
        , span [] []
        ]