rundis/elm-bootstrap/1.1.0

NOTE: this package is not compatible with Elm 0.19.1

Bootstrap.Table

Create simple nice and customizable tables in a fairly type safe manner !

Table

simpleTable : ( THead msg, TBody msg ) -> Html msg

Allows you to create a simple default table

  • (thead, tbody) - A tuple of a thead item and a tbody item
{ options : List (TableOption msg)
, thead : THead msg
, tbody : TBody msg
}
-> Html msg

Create a customizable table

Table.table
    { options = [ Table.striped ] -- list of table options
    , thead = Table.thead ... etc
    , tbody = Table.tbody ... etc
    }

Table options

inversed : TableOption msg

Option to give a table an inversed color scheme (dark backround, light text)

striped : TableOption msg

Option to give a table a striped look (zebra style)

bordered : TableOption msg

Option to put borders around a table

hover : TableOption msg

Change row coloring to highlight row when hovered over

small : TableOption msg

Option to give a more condensed table with less padding/margins

responsive : TableOption msg

Make table scroll horizontally on small devices (under 768px). When viewing on anything larger than 768px wide, you will not see any difference in the table.

reflow : TableOption msg

Turn traditional tables on their side. When using reflow, the table header becomes the first column of the table, the first row within the table body becomes the second column, the second row becomes the third column, etc. Only works out nicely for simple tables (e.g. no colspans, rowspans or multiple header rows etc.)

attr : Attribute msg -> TableOption msg

When you need to customize the table element with standard Html.Attribute, use this function to create it as a TableOption

type TableOption msg

Opaque type representing possible styling options for a table

Table headers

simpleThead : List (Cell msg) -> THead msg

Create a default thead with one row of cells (typically th elements)

simpleThead
    [ Table.th [] [ text "Col1" ]
    , Table.th [] [ text "Col2" ]
    ]
thead : List (TableHeadOption msg) -> List (Row msg) -> THead msg

Create a customizable thead element

  • options List of options to style the thead element
  • rows List of rows (aka tr)
headAttr : Attribute msg -> TableHeadOption msg

When you need to customize the thead element with standard Html.Attribute, use this function to create a TableHeadOption

type THead msg

Opaque type representing a thead element

Header options

defaultHead : TableHeadOption msg

Option to color header with default color scheme.

inversedHead : TableHeadOption msg

Option to inverse thead element. Dark background and light text color

Opaque type representing possible styling options for a thead element

Table body

tbody : List (Attribute msg) -> List (Row msg) -> TBody msg

Create a tbody element

  • attributes List of standard Elm html attributes
  • rows List of table row elements (tr)
type TBody msg

Opaque type representing a tbody element

Rows

tr : List (RowOption msg) -> List (Cell msg) -> Row msg

Create a table row

-- For use (typically) in a tbody
Table.tr
    [ Table.rowInfo ]
    [ Table.td [] [ text "Some cell" ]
    , Table.td [] [ text "Another cell" ]
    ]


-- alternatively when creating a thead
Table.tr
    [ Table.rowInfo ]
    [ Table.th [] [ text "Col1" ]
    , Table.th [] [ text "Col2" ]
    ]
type Row msg

Opaque type representing a tr

Row options

rowActive : RowOption msg

Style table row with active color.

rowInfo : RowOption msg

Style table row with info color.

rowSuccess : RowOption msg

Style table row with success color.

rowWarning : RowOption msg

Style table row with warning color.

rowDanger : RowOption msg

Style table row with danger color.

rowAttr : Attribute msg -> RowOption msg

When you need to customize a tr element with standard Html.Attribute attributes, use this function

type RowOption msg

Opaque type representing possible styling options for a tr element (both in thead and tbody)

Cells

td : List (CellOption msg) -> List (Html msg) -> Cell msg

Create a td element

Table.td [ Table.cellInfo ] [ text "Some info cell"]
  • options List of options for customizing
  • children List of child elements
th : List (CellOption msg) -> List (Html msg) -> Cell msg

Create a th element

Table.th [ Table.cellInfo ] [ text "Some info header cell"]
  • options List of options for customizing
  • children List of child elements
type Cell msg

Opaque type representing a cell (tr or td)

Cell options

cellActive : CellOption msg

Option to style an individual cell with active color

cellInfo : CellOption msg

Option to style an individual cell with info color

cellSuccess : CellOption msg

Option to style an individual cell with success color

cellWarning : CellOption msg

Option to style an individual cell with warning color

cellDanger : CellOption msg

Option to style an individual cell with danger color

cellAttr : Attribute msg -> CellOption msg

When you need to customize a td or th with standard Html.Attribute attributes, use this function

type CellOption msg

Opaque type representing possible styling options for a cell, ie td and th