Current section

Files

Jump to
glaze_basecoat src glaze@basecoat@table.erl
Raw

src/glaze@basecoat@table.erl

-module(glaze@basecoat@table).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-define(FILEPATH, "src/glaze/basecoat/table.gleam").
-export([table/2, scrollable/2, caption/2, thead/2, tbody/2, tfoot/2, tr/2, th/2, td/2, align_right/0, font_medium/0]).
-if(?OTP_RELEASE >= 27).
-define(MODULEDOC(Str), -moduledoc(Str)).
-define(DOC(Str), -doc(Str)).
-else.
-define(MODULEDOC(Str), -compile([])).
-define(DOC(Str), -compile([])).
-endif.
?MODULEDOC(
" Basecoat documentation: <https://basecoatui.com/components/table/>\n"
"\n"
" Table helpers for data grids and record lists.\n"
"\n"
" ## Recipe\n"
"\n"
" ```gleam\n"
" import glaze/basecoat/table\n"
" import lustre/element/html\n"
"\n"
" fn invoices_table() {\n"
" table.scrollable([], [\n"
" table.table([], [\n"
" table.thead([], [\n"
" table.tr([], [\n"
" table.th([], [html.text(\"Invoice\")]),\n"
" table.th([], [html.text(\"Status\")]),\n"
" table.th([table.align_right()], [html.text(\"Amount\")]),\n"
" ]),\n"
" ]),\n"
" table.tbody([], [\n"
" table.tr([], [\n"
" table.td([], [html.text(\"INV001\")]),\n"
" table.td([], [html.text(\"Paid\")]),\n"
" table.td([table.align_right(), table.font_medium()], [html.text(\"$250.00\")]),\n"
" ]),\n"
" ]),\n"
" ])\n"
" ])\n"
" }\n"
" ```\n"
"\n"
).
-file("src/glaze/basecoat/table.gleam", 38).
-spec table(
list(lustre@vdom@vattr:attribute(TSP)),
list(lustre@vdom@vnode:element(TSP))
) -> lustre@vdom@vnode:element(TSP).
table(Attrs, Children) ->
lustre@element@html:table(
[lustre@attribute:class(<<"table"/utf8>>) | Attrs],
Children
).
-file("src/glaze/basecoat/table.gleam", 45).
-spec scrollable(
list(lustre@vdom@vattr:attribute(TSV)),
list(lustre@vdom@vnode:element(TSV))
) -> lustre@vdom@vnode:element(TSV).
scrollable(Attrs, Children) ->
lustre@element@html:'div'(
[lustre@attribute:class(<<"overflow-x-auto"/utf8>>) | Attrs],
Children
).
-file("src/glaze/basecoat/table.gleam", 52).
-spec caption(
list(lustre@vdom@vattr:attribute(TTB)),
list(lustre@vdom@vnode:element(TTB))
) -> lustre@vdom@vnode:element(TTB).
caption(Attrs, Children) ->
lustre@element@html:caption(Attrs, Children).
-file("src/glaze/basecoat/table.gleam", 59).
-spec thead(
list(lustre@vdom@vattr:attribute(TTH)),
list(lustre@vdom@vnode:element(TTH))
) -> lustre@vdom@vnode:element(TTH).
thead(Attrs, Children) ->
lustre@element@html:thead(Attrs, Children).
-file("src/glaze/basecoat/table.gleam", 66).
-spec tbody(
list(lustre@vdom@vattr:attribute(TTN)),
list(lustre@vdom@vnode:element(TTN))
) -> lustre@vdom@vnode:element(TTN).
tbody(Attrs, Children) ->
lustre@element@html:tbody(Attrs, Children).
-file("src/glaze/basecoat/table.gleam", 73).
-spec tfoot(
list(lustre@vdom@vattr:attribute(TTT)),
list(lustre@vdom@vnode:element(TTT))
) -> lustre@vdom@vnode:element(TTT).
tfoot(Attrs, Children) ->
lustre@element@html:tfoot(Attrs, Children).
-file("src/glaze/basecoat/table.gleam", 80).
-spec tr(
list(lustre@vdom@vattr:attribute(TTZ)),
list(lustre@vdom@vnode:element(TTZ))
) -> lustre@vdom@vnode:element(TTZ).
tr(Attrs, Children) ->
lustre@element@html:tr(Attrs, Children).
-file("src/glaze/basecoat/table.gleam", 87).
-spec th(
list(lustre@vdom@vattr:attribute(TUF)),
list(lustre@vdom@vnode:element(TUF))
) -> lustre@vdom@vnode:element(TUF).
th(Attrs, Children) ->
lustre@element@html:th(Attrs, Children).
-file("src/glaze/basecoat/table.gleam", 94).
-spec td(
list(lustre@vdom@vattr:attribute(TUL)),
list(lustre@vdom@vnode:element(TUL))
) -> lustre@vdom@vnode:element(TUL).
td(Attrs, Children) ->
lustre@element@html:td(Attrs, Children).
-file("src/glaze/basecoat/table.gleam", 101).
-spec align_right() -> lustre@vdom@vattr:attribute(any()).
align_right() ->
lustre@attribute:class(<<"text-right"/utf8>>).
-file("src/glaze/basecoat/table.gleam", 105).
-spec font_medium() -> lustre@vdom@vattr:attribute(any()).
font_medium() ->
lustre@attribute:class(<<"font-medium"/utf8>>).