mbr/elm-chadcn/1.0.0

ChadCn.Table

Provides a typed table.

The implementation follows the shadcn Base UI structure and Nova defaults. The column API adds a typed projection over the upstream structural primitives.

= Left
| Center
| Right

Describes horizontal column alignment.

type Column row msg

Describes a table column and its row projection.

type Config row msg

Describes a table and its presentation.

type alias Model row =
List row

Describes the caller-owned rows displayed by a table.

= NoWrap
| Wrap

Describes whether data cells preserve content on one line.

new : Config row msg

Creates an empty table configuration.

addColumn : Column row msg -> Config row msg -> Config row msg

Adds a configured column to a table.

view : Model row -> Config row msg -> Html msg

Renders a configured table from caller-owned rows.

newColumn : Column row msg

Creates an empty left-aligned column.

withAlignment : Alignment -> Column row msg -> Column row msg

Sets the horizontal alignment of a column.

withCellAttributes : List (Attribute msg) -> Column row msg -> Column row msg

Adds attributes to a column's data cells.

withCellRenderer : (row -> Html msg) -> Column row msg -> Column row msg

Adds a row projection to a column.

withHeading : Html msg -> Column row msg -> Column row msg

Adds custom heading content to a column.

withHeadingAttributes : List (Attribute msg) -> Column row msg -> Column row msg

Adds attributes to a column heading cell.

withRowHeading : Column row msg -> Column row msg

Renders a column's data cells as semantic row headings.

withWrapping : Wrapping -> Column row msg -> Column row msg

Sets whether a column's data cells may wrap.

withBodyAttributes : List (Attribute msg) -> Config row msg -> Config row msg

Adds attributes to the table body.

withCaption : Html msg -> Config row msg -> Config row msg

Adds a caption to a table.

withContainerAttributes : List (Attribute msg) -> Config row msg -> Config row msg

Adds attributes to the horizontal overflow container.

withHeaderAttributes : List (Attribute msg) -> Config row msg -> Config row msg

Adds attributes to the table header.

withRowAttributes : List (Attribute msg) -> Config row msg -> Config row msg

Adds attributes to every table row.

withTableAttributes : List (Attribute msg) -> Config row msg -> Config row msg

Adds attributes to the table element.