Current section
Files
Jump to
Current section
Files
src/glaze@basecoat@button.erl
-module(glaze@basecoat@button).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-define(FILEPATH, "src/glaze/basecoat/button.gleam").
-export([group/2, button/2, secondary/2, destructive/2, outline/2, ghost/2, link_style/2, icon/2, icon_outline/2, icon_destructive/2, link/2, link_secondary/2, link_outline/2, link_ghost/2, link_destructive/2, small/0, large/0, full_width/0, disabled/0, loading/0, submit/2, reset/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(
" Basecoat documentation: <https://basecoatui.com/components/button/>\n"
"\n"
" The [`button`](#button) helpers style interactive actions and links with a\n"
" consistent API.\n"
"\n"
" Use regular buttons for in-page actions, and use [`link`](#link) when the\n"
" interaction navigates to a different location.\n"
"\n"
" ## Anatomy\n"
"\n"
" A button setup usually has one interactive element and optional button groups.\n"
" `group` wraps multiple actions in a semantic menu/list structure so spacing\n"
" and alignment stay consistent.\n"
"\n"
" ## Recipes\n"
"\n"
" ### A primary action button\n"
"\n"
" ```gleam\n"
" import glaze/basecoat/button\n"
" import lustre/element/html\n"
"\n"
" fn save_button() {\n"
" button.button([], [html.text(\"Save\")])\n"
" }\n"
" ```\n"
"\n"
" ### A grouped action row\n"
"\n"
" ```gleam\n"
" import glaze/basecoat/button\n"
" import lustre/element/html\n"
"\n"
" fn actions() {\n"
" button.group([], [\n"
" button.button([button.outline()], [html.text(\"Cancel\")]),\n"
" button.button([], [html.text(\"Continue\")]),\n"
" ])\n"
" }\n"
" ```\n"
"\n"
" ### A link styled as button\n"
"\n"
" ```gleam\n"
" import glaze/basecoat/button\n"
" import lustre/attribute\n"
" import lustre/element/html\n"
"\n"
" fn docs_link() {\n"
" button.link([attribute.href(\"/docs\"), button.outline()], [\n"
" html.text(\"Read docs\"),\n"
" ])\n"
" }\n"
" ```\n"
"\n"
" ## Variants\n"
"\n"
" - [`primary`](#primary) - Primary button (default `btn`)\n"
" - [`secondary`](#secondary) - Secondary button\n"
" - [`destructive`](#destructive) - Destructive/danger button\n"
" - [`outline`](#outline) - Outline button\n"
" - [`ghost`](#ghost) - Ghost button\n"
" - [`link`](#link) - Link-styled button\n"
"\n"
" ## Sizes\n"
"\n"
" - [`small`](#small) - Small button\n"
" - [`large`](#large) - Large button\n"
"\n"
).
-file("src/glaze/basecoat/button.gleam", 75).
-spec group(
list(lustre@vdom@vattr:attribute(PQD)),
list(lustre@vdom@vnode:element(PQD))
) -> lustre@vdom@vnode:element(PQD).
group(Attrs, Children) ->
lustre@element@html:'div'(
[lustre@attribute:class(<<"flex items-center gap-2"/utf8>>) | Attrs],
Children
).
-file("src/glaze/basecoat/button.gleam", 82).
-spec button(
list(lustre@vdom@vattr:attribute(PQJ)),
list(lustre@vdom@vnode:element(PQJ))
) -> lustre@vdom@vnode:element(PQJ).
button(Attrs, Children) ->
lustre@element@html:button(
[lustre@attribute:class(<<"btn"/utf8>>),
lustre@attribute:type_(<<"button"/utf8>>) |
Attrs],
Children
).
-file("src/glaze/basecoat/button.gleam", 92).
-spec secondary(
list(lustre@vdom@vattr:attribute(PQP)),
list(lustre@vdom@vnode:element(PQP))
) -> lustre@vdom@vnode:element(PQP).
secondary(Attrs, Children) ->
lustre@element@html:button(
[lustre@attribute:class(<<"btn-secondary"/utf8>>),
lustre@attribute:type_(<<"button"/utf8>>) |
Attrs],
Children
).
-file("src/glaze/basecoat/button.gleam", 102).
-spec destructive(
list(lustre@vdom@vattr:attribute(PQV)),
list(lustre@vdom@vnode:element(PQV))
) -> lustre@vdom@vnode:element(PQV).
destructive(Attrs, Children) ->
lustre@element@html:button(
[lustre@attribute:class(<<"btn-destructive"/utf8>>),
lustre@attribute:type_(<<"button"/utf8>>) |
Attrs],
Children
).
-file("src/glaze/basecoat/button.gleam", 112).
-spec outline(
list(lustre@vdom@vattr:attribute(PRB)),
list(lustre@vdom@vnode:element(PRB))
) -> lustre@vdom@vnode:element(PRB).
outline(Attrs, Children) ->
lustre@element@html:button(
[lustre@attribute:class(<<"btn-outline"/utf8>>),
lustre@attribute:type_(<<"button"/utf8>>) |
Attrs],
Children
).
-file("src/glaze/basecoat/button.gleam", 122).
-spec ghost(
list(lustre@vdom@vattr:attribute(PRH)),
list(lustre@vdom@vnode:element(PRH))
) -> lustre@vdom@vnode:element(PRH).
ghost(Attrs, Children) ->
lustre@element@html:button(
[lustre@attribute:class(<<"btn-ghost"/utf8>>),
lustre@attribute:type_(<<"button"/utf8>>) |
Attrs],
Children
).
-file("src/glaze/basecoat/button.gleam", 132).
-spec link_style(
list(lustre@vdom@vattr:attribute(PRN)),
list(lustre@vdom@vnode:element(PRN))
) -> lustre@vdom@vnode:element(PRN).
link_style(Attrs, Children) ->
lustre@element@html:button(
[lustre@attribute:class(<<"btn-link"/utf8>>),
lustre@attribute:type_(<<"button"/utf8>>) |
Attrs],
Children
).
-file("src/glaze/basecoat/button.gleam", 142).
-spec icon(
list(lustre@vdom@vattr:attribute(PRT)),
list(lustre@vdom@vnode:element(PRT))
) -> lustre@vdom@vnode:element(PRT).
icon(Attrs, Children) ->
lustre@element@html:button(
[lustre@attribute:class(<<"btn-icon"/utf8>>),
lustre@attribute:type_(<<"button"/utf8>>) |
Attrs],
Children
).
-file("src/glaze/basecoat/button.gleam", 152).
-spec icon_outline(
list(lustre@vdom@vattr:attribute(PRZ)),
list(lustre@vdom@vnode:element(PRZ))
) -> lustre@vdom@vnode:element(PRZ).
icon_outline(Attrs, Children) ->
lustre@element@html:button(
[lustre@attribute:class(<<"btn-icon-outline"/utf8>>),
lustre@attribute:type_(<<"button"/utf8>>) |
Attrs],
Children
).
-file("src/glaze/basecoat/button.gleam", 162).
-spec icon_destructive(
list(lustre@vdom@vattr:attribute(PSF)),
list(lustre@vdom@vnode:element(PSF))
) -> lustre@vdom@vnode:element(PSF).
icon_destructive(Attrs, Children) ->
lustre@element@html:button(
[lustre@attribute:class(<<"btn-icon-destructive"/utf8>>),
lustre@attribute:type_(<<"button"/utf8>>) |
Attrs],
Children
).
-file("src/glaze/basecoat/button.gleam", 176).
-spec link(
list(lustre@vdom@vattr:attribute(PSL)),
list(lustre@vdom@vnode:element(PSL))
) -> lustre@vdom@vnode:element(PSL).
link(Attrs, Children) ->
lustre@element@html:a(
[lustre@attribute:class(<<"btn"/utf8>>) | Attrs],
Children
).
-file("src/glaze/basecoat/button.gleam", 183).
-spec link_secondary(
list(lustre@vdom@vattr:attribute(PSR)),
list(lustre@vdom@vnode:element(PSR))
) -> lustre@vdom@vnode:element(PSR).
link_secondary(Attrs, Children) ->
lustre@element@html:a(
[lustre@attribute:class(<<"btn-secondary"/utf8>>) | Attrs],
Children
).
-file("src/glaze/basecoat/button.gleam", 190).
-spec link_outline(
list(lustre@vdom@vattr:attribute(PSX)),
list(lustre@vdom@vnode:element(PSX))
) -> lustre@vdom@vnode:element(PSX).
link_outline(Attrs, Children) ->
lustre@element@html:a(
[lustre@attribute:class(<<"btn-outline"/utf8>>) | Attrs],
Children
).
-file("src/glaze/basecoat/button.gleam", 197).
-spec link_ghost(
list(lustre@vdom@vattr:attribute(PTD)),
list(lustre@vdom@vnode:element(PTD))
) -> lustre@vdom@vnode:element(PTD).
link_ghost(Attrs, Children) ->
lustre@element@html:a(
[lustre@attribute:class(<<"btn-ghost"/utf8>>) | Attrs],
Children
).
-file("src/glaze/basecoat/button.gleam", 204).
-spec link_destructive(
list(lustre@vdom@vattr:attribute(PTJ)),
list(lustre@vdom@vnode:element(PTJ))
) -> lustre@vdom@vnode:element(PTJ).
link_destructive(Attrs, Children) ->
lustre@element@html:a(
[lustre@attribute:class(<<"btn-destructive"/utf8>>) | Attrs],
Children
).
-file("src/glaze/basecoat/button.gleam", 211).
-spec small() -> lustre@vdom@vattr:attribute(any()).
small() ->
lustre@attribute:class(<<"btn-sm"/utf8>>).
-file("src/glaze/basecoat/button.gleam", 215).
-spec large() -> lustre@vdom@vattr:attribute(any()).
large() ->
lustre@attribute:class(<<"btn-lg"/utf8>>).
-file("src/glaze/basecoat/button.gleam", 219).
-spec full_width() -> lustre@vdom@vattr:attribute(any()).
full_width() ->
lustre@attribute:class(<<"w-full"/utf8>>).
-file("src/glaze/basecoat/button.gleam", 223).
-spec disabled() -> lustre@vdom@vattr:attribute(any()).
disabled() ->
lustre@attribute:disabled(true).
-file("src/glaze/basecoat/button.gleam", 227).
-spec loading() -> lustre@vdom@vattr:attribute(any()).
loading() ->
lustre@attribute:disabled(true).
-file("src/glaze/basecoat/button.gleam", 231).
-spec submit(
list(lustre@vdom@vattr:attribute(PTZ)),
list(lustre@vdom@vnode:element(PTZ))
) -> lustre@vdom@vnode:element(PTZ).
submit(Attrs, Children) ->
lustre@element@html:button(
[lustre@attribute:class(<<"btn"/utf8>>),
lustre@attribute:type_(<<"submit"/utf8>>) |
Attrs],
Children
).
-file("src/glaze/basecoat/button.gleam", 241).
-spec reset(
list(lustre@vdom@vattr:attribute(PUF)),
list(lustre@vdom@vnode:element(PUF))
) -> lustre@vdom@vnode:element(PUF).
reset(Attrs, Children) ->
lustre@element@html:button(
[lustre@attribute:class(<<"btn"/utf8>>),
lustre@attribute:type_(<<"reset"/utf8>>) |
Attrs],
Children
).