Packages

🍩 Lustre Bindings to Oat UI Components

Current section

Files

Jump to
glaze_oat src glaze@oat@table.erl
Raw

src/glaze@oat@table.erl

-module(glaze@oat@table).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-define(FILEPATH, "src/glaze/oat/table.gleam").
-export([container/2, table/2, thead/2, tbody/2, tr/2, th/2, td/2]).
-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(
" Oat documentation: <https://oat.ink/components/table/>\n"
"\n"
" Table helpers for data grids and record lists.\n"
"\n"
" ## Anatomy\n"
"\n"
" Wrap tables with [`container`](#container) for Oat table styling, then build\n"
" rows and cells with regular table primitives.\n"
"\n"
" ## Recipe\n"
"\n"
" ```gleam\n"
" import glaze/oat/table\n"
" import lustre/element/html\n"
"\n"
" table.container([], [\n"
" table.table([], [\n"
" table.thead([], [\n"
" table.tr([], [\n"
" table.th([], [html.text(\"Name\")]),\n"
" table.th([], [html.text(\"Role\")]),\n"
" ]),\n"
" ]),\n"
" table.tbody([], [\n"
" table.tr([], [\n"
" table.td([], [html.text(\"Casey\")]),\n"
" table.td([], [html.text(\"Admin\")]),\n"
" ]),\n"
" ]),\n"
" ]),\n"
" ])\n"
" ```\n"
).
-file("src/glaze/oat/table.gleam", 40).
?DOC(" Render the table wrapper used by Oat styling.\n").
-spec container(
list(lustre@vdom@vattr:attribute(QQC)),
list(lustre@vdom@vnode:element(QQC))
) -> lustre@vdom@vnode:element(QQC).
container(Attrs, Children) ->
lustre@element@html:'div'(
[lustre@attribute:class(<<"table"/utf8>>) | Attrs],
Children
).
-file("src/glaze/oat/table.gleam", 47).
-spec table(
list(lustre@vdom@vattr:attribute(QQI)),
list(lustre@vdom@vnode:element(QQI))
) -> lustre@vdom@vnode:element(QQI).
table(Attrs, Children) ->
lustre@element@html:table(Attrs, Children).
-file("src/glaze/oat/table.gleam", 54).
-spec thead(
list(lustre@vdom@vattr:attribute(QQO)),
list(lustre@vdom@vnode:element(QQO))
) -> lustre@vdom@vnode:element(QQO).
thead(Attrs, Children) ->
lustre@element@html:thead(Attrs, Children).
-file("src/glaze/oat/table.gleam", 61).
-spec tbody(
list(lustre@vdom@vattr:attribute(QQU)),
list(lustre@vdom@vnode:element(QQU))
) -> lustre@vdom@vnode:element(QQU).
tbody(Attrs, Children) ->
lustre@element@html:tbody(Attrs, Children).
-file("src/glaze/oat/table.gleam", 68).
-spec tr(
list(lustre@vdom@vattr:attribute(QRA)),
list(lustre@vdom@vnode:element(QRA))
) -> lustre@vdom@vnode:element(QRA).
tr(Attrs, Children) ->
lustre@element@html:tr(Attrs, Children).
-file("src/glaze/oat/table.gleam", 75).
-spec th(
list(lustre@vdom@vattr:attribute(QRG)),
list(lustre@vdom@vnode:element(QRG))
) -> lustre@vdom@vnode:element(QRG).
th(Attrs, Children) ->
lustre@element@html:th(Attrs, Children).
-file("src/glaze/oat/table.gleam", 82).
-spec td(
list(lustre@vdom@vattr:attribute(QRM)),
list(lustre@vdom@vnode:element(QRM))
) -> lustre@vdom@vnode:element(QRM).
td(Attrs, Children) ->
lustre@element@html:td(Attrs, Children).