Current section
Files
Jump to
Current section
Files
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(TQD)),
list(lustre@vdom@vnode:element(TQD))
) -> lustre@vdom@vnode:element(TQD).
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(TQJ)),
list(lustre@vdom@vnode:element(TQJ))
) -> lustre@vdom@vnode:element(TQJ).
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(TQP)),
list(lustre@vdom@vnode:element(TQP))
) -> lustre@vdom@vnode:element(TQP).
caption(Attrs, Children) ->
lustre@element@html:caption(Attrs, Children).
-file("src/glaze/basecoat/table.gleam", 59).
-spec thead(
list(lustre@vdom@vattr:attribute(TQV)),
list(lustre@vdom@vnode:element(TQV))
) -> lustre@vdom@vnode:element(TQV).
thead(Attrs, Children) ->
lustre@element@html:thead(Attrs, Children).
-file("src/glaze/basecoat/table.gleam", 66).
-spec tbody(
list(lustre@vdom@vattr:attribute(TRB)),
list(lustre@vdom@vnode:element(TRB))
) -> lustre@vdom@vnode:element(TRB).
tbody(Attrs, Children) ->
lustre@element@html:tbody(Attrs, Children).
-file("src/glaze/basecoat/table.gleam", 73).
-spec tfoot(
list(lustre@vdom@vattr:attribute(TRH)),
list(lustre@vdom@vnode:element(TRH))
) -> lustre@vdom@vnode:element(TRH).
tfoot(Attrs, Children) ->
lustre@element@html:tfoot(Attrs, Children).
-file("src/glaze/basecoat/table.gleam", 80).
-spec tr(
list(lustre@vdom@vattr:attribute(TRN)),
list(lustre@vdom@vnode:element(TRN))
) -> lustre@vdom@vnode:element(TRN).
tr(Attrs, Children) ->
lustre@element@html:tr(Attrs, Children).
-file("src/glaze/basecoat/table.gleam", 87).
-spec th(
list(lustre@vdom@vattr:attribute(TRT)),
list(lustre@vdom@vnode:element(TRT))
) -> lustre@vdom@vnode:element(TRT).
th(Attrs, Children) ->
lustre@element@html:th(Attrs, Children).
-file("src/glaze/basecoat/table.gleam", 94).
-spec td(
list(lustre@vdom@vattr:attribute(TRZ)),
list(lustre@vdom@vnode:element(TRZ))
) -> lustre@vdom@vnode:element(TRZ).
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>>).