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(SSU)),
list(lustre@vdom@vnode:element(SSU))
) -> lustre@vdom@vnode:element(SSU).
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(STA)),
list(lustre@vdom@vnode:element(STA))
) -> lustre@vdom@vnode:element(STA).
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(STG)),
list(lustre@vdom@vnode:element(STG))
) -> lustre@vdom@vnode:element(STG).
caption(Attrs, Children) ->
lustre@element@html:caption(Attrs, Children).
-file("src/glaze/basecoat/table.gleam", 59).
-spec thead(
list(lustre@vdom@vattr:attribute(STM)),
list(lustre@vdom@vnode:element(STM))
) -> lustre@vdom@vnode:element(STM).
thead(Attrs, Children) ->
lustre@element@html:thead(Attrs, Children).
-file("src/glaze/basecoat/table.gleam", 66).
-spec tbody(
list(lustre@vdom@vattr:attribute(STS)),
list(lustre@vdom@vnode:element(STS))
) -> lustre@vdom@vnode:element(STS).
tbody(Attrs, Children) ->
lustre@element@html:tbody(Attrs, Children).
-file("src/glaze/basecoat/table.gleam", 73).
-spec tfoot(
list(lustre@vdom@vattr:attribute(STY)),
list(lustre@vdom@vnode:element(STY))
) -> lustre@vdom@vnode:element(STY).
tfoot(Attrs, Children) ->
lustre@element@html:tfoot(Attrs, Children).
-file("src/glaze/basecoat/table.gleam", 80).
-spec tr(
list(lustre@vdom@vattr:attribute(SUE)),
list(lustre@vdom@vnode:element(SUE))
) -> lustre@vdom@vnode:element(SUE).
tr(Attrs, Children) ->
lustre@element@html:tr(Attrs, Children).
-file("src/glaze/basecoat/table.gleam", 87).
-spec th(
list(lustre@vdom@vattr:attribute(SUK)),
list(lustre@vdom@vnode:element(SUK))
) -> lustre@vdom@vnode:element(SUK).
th(Attrs, Children) ->
lustre@element@html:th(Attrs, Children).
-file("src/glaze/basecoat/table.gleam", 94).
-spec td(
list(lustre@vdom@vattr:attribute(SUQ)),
list(lustre@vdom@vnode:element(SUQ))
) -> lustre@vdom@vnode:element(SUQ).
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>>).