MichaelCombs28/elm-css-bulma/1.0.0

Bulma.Styled.Layout

type alias Container msg =
Html msg
container : List (Attribute msg) -> List (Html msg) -> Container msg

A simple container to center your content horizontally.

myContainer : Html msg
myContainer =
    container []
        [ p []
            [ text "My container is centered on a desktop!"
            ]
        ]

Containers can be used in any context, but mostly as a direct child of:

  • navbar
  • hero
  • section
  • footer
fluidContainer : List (Attribute msg) -> List (Html msg) -> Container msg

If you don't want to have a maximum width, but want to keep the 24px margin on the left and right sides, fluidContainer is for you!

myFluidContainer : Html msg
myFluidContainer
  = container []
    [ p []
      [ text "My container will have a 24px gap on its left and right."
      ]
    [ p []
      [ text "This gap holds for all viewport sizes."
      ]
    ]
widescreenContainer : List (Attribute msg) -> List (Html msg) -> Container msg

This container is full-width until the "widescreen" breakpoint.

myWidescreenContainer : Html msg
myWidescreenContainer =
    widescreenContainer []
        [ p [] [ text "This container fills the screen-width..." ]
        , p [] [ text "...until it hits the widescreen breakpoint." ]
        ]
fullHDContainer : List (Attribute msg) -> List (Html msg) -> Container msg

This container is full-width until the "fullHD" breakpoint.

fullHDContainer : Html msg
fullHDContainer =
    widescreenContainer []
        [ p [] [ text "This container fills the screen-width..." ]
        , p [] [ text "...until it hits the fullHD breakpoint." ]
        ]

Level

type alias Level msg =
Html msg
level : List (Attribute msg) -> List (LevelPartition msg) -> Level msg
myLevel : Html msg
myLevel =
    level []
        [ levelLeft []
            [ levelItem [] []
            , levelItem [] []
            , levelItem [] []
            ]
        , levelRight []
            [ levelItem [] []
            , levelItem [] []
            , levelItem [] []
            ]
        ]
horizontalLevel : List (Attribute msg) -> List (LevelPartition msg) -> Level msg
centeredLevel : List (Attribute msg) -> List (LevelItem msg) -> Level msg
myLevel : Html msg
myLevel =
    centeredLevel []
        [ levelItem [] []
        , levelItem [] []
        , levelItem [] []
        ]

Level Partition

type alias LevelPartition msg =
Html msg
levelLeft : List (Attribute msg) -> List (LevelItem msg) -> LevelPartition msg
levelRight : List (Attribute msg) -> List (LevelItem msg) -> LevelPartition msg

Level Item

type alias LevelItem msg =
Html msg
levelItem : List (Attribute msg) -> List (Html msg) -> LevelItem msg
levelItemText : List (Attribute msg) -> List (Html msg) -> LevelItem msg
easyLevelItemWithHeading : List (Attribute msg) -> String -> String -> LevelItem msg

Media Object

type alias Media msg =
Html msg
media : List (Attribute msg) -> List (MediaPartition msg) -> Media msg
myMediaObject : Html msg
myMediaObject =
    media []
        [ mediaLeft [] []
        , mediaContent [] []
        , mediaRight [] []
        ]

Media Object Partition

type alias MediaPartition msg =
Html msg
mediaContent : List (Attribute msg) -> List (Html msg) -> MediaPartition msg
mediaLeft : List (Attribute msg) -> List (Html msg) -> MediaPartition msg
mediaRight : List (Attribute msg) -> List (Html msg) -> MediaPartition msg

Hero

type alias Hero msg =
Html msg
type alias HeroModifiers =
{ bold : Bool
, size : Size
, color : Color
}
heroModifiers : HeroModifiers

These are the stylistic defaults for hero containers.

import B.Modifiers
    exposing
        ( Color(Default)
        , Size(Standard)
        )




-- Small    -> "is-small"
-- Standard -> "is-medium"
-- Medium   -> "is-large"
-- Large    -> "is-fullheight"
myHeroModifiers : HeroModifiers
myHeroModifiers =
    { bold = False
    , size = Large
    , color = Default
    }
HeroModifiers
-> List (Attribute msg)
-> List (HeroPartition msg)
-> Hero msg

An imposing Hero banner to showcase something.

import B.Elements exposing (TitleSize(H1, H2), title)
import B.Layout exposing (container, hero, heroBody)


myHero : Html msg
myHero =
    hero myHeroModifiers
        []
        [ heroBody []
            [ container []
                [ title H1 [] [ text "Hero Title" ]
                , title H2 [] [ text "Hero Subtitle" ]
                ]
            ]
        ]
HeroModifiers
-> List (Attribute msg)
-> { head : HeroPartition msg
, body : HeroPartition msg
, foot : HeroPartition msg
}
-> Hero msg

The hero element with some added guard-rails.

myHero : Html msg
myHero =
    easyHero myHeroModifiers
        []
        { head = heroHead [] []
        , body = heroBody [] []
        , foot = heroFoot [] []
        }

Hero Partition

type alias HeroPartition msg =
Html msg
heroBody : List (Attribute msg) -> List (Html msg) -> HeroPartition msg
heroFoot : List (Attribute msg) -> List (Html msg) -> HeroPartition msg
heroHead : List (Attribute msg) -> List (Html msg) -> HeroPartition msg

Section

type alias Section msg =
Html msg
-> List (Attribute msg)
-> List (Html msg)
-> Section msg

Use sections as direct children of your top HTML element.

view : Model -> Html msg
view model =
    div []
        [ section NotSpaced
            []
            [ container []
                [ p [] [ text "Containers for your containers!" ]
                ]
            ]
        ]

Footer

Tile

Learn more about tiled grids in the official docs.

myGrid : Html msg
myGrid =
    tileAncestor Auto
        []
        [ verticalTile Width8
            []
            [ tile Auto
                []
                [ verticalTileParent Auto
                    []
                    [ tileChild Auto
                        []
                        [ text "I'm in the top-left corner!"
                        ]
                    , [ text "I'm on the middle-left edge!"
                      ]
                    ]
                , tileParent Auto
                    []
                    [ text "I'm a tile touching the top-middle edge!"
                    ]
                ]
            , tileParent Auto
                []
                [ tileChild Auto
                    []
                    [ text "I'm taking up the bottom-left half of the grid!"
                    ]
                ]
            ]
        , tileParent Auto
            []
            [ tileChild Auto
                []
                [ text "I'm a tall column taking up the entire right edge!"
                ]
            ]
        ]
type alias Tile msg =
Html msg
tile : Width -> List (Attribute msg) -> List (Tile msg) -> Tile msg

This element is a plain tile container. It's best used as an intermediate tile in a 2D grid. You can also add "is-ancestor", "is-parent", "is-child", and "is-vertical" classes to to make a custom Bulma-grid implementation.

tileAncestor : Width -> List (Attribute msg) -> List (Tile msg) -> Html msg

This should always be your outer-most tile.

myGrid : Html msg
myGrid =
    tileAncestor Auto
        []
        [ tileParent Width8
            []
            [ tileChild Auto [] []
            , tileChild Auto [] []
            ]
        , verticalTileParent Width4
            []
            [ tileChild Auto [] []
            , tileChild Auto [] []
            ]
        ]
tileParent : Width -> List (Attribute msg) -> List (Tile msg) -> Tile msg

Your tile-children must always be accompanied by a parent!

tileChild : Width -> List (Attribute msg) -> List (Html msg) -> Tile msg

This tile holds your content! Its parent should always be tileParent or verticalTileParent.

verticalTile : Width -> List (Attribute msg) -> List (Tile msg) -> Tile msg

If you want to stack tiles vertically, use a vertical tile!

verticalTileParent : Width -> List (Attribute msg) -> List (Tile msg) -> Tile msg

Your tile-children must always be accompanied by a parent!