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(QGG)),
list(lustre@vdom@vnode:element(QGG))
) -> lustre@vdom@vnode:element(QGG).
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(QGM)),
list(lustre@vdom@vnode:element(QGM))
) -> lustre@vdom@vnode:element(QGM).
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(QGS)),
list(lustre@vdom@vnode:element(QGS))
) -> lustre@vdom@vnode:element(QGS).
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(QGY)),
list(lustre@vdom@vnode:element(QGY))
) -> lustre@vdom@vnode:element(QGY).
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(QHE)),
list(lustre@vdom@vnode:element(QHE))
) -> lustre@vdom@vnode:element(QHE).
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(QHK)),
list(lustre@vdom@vnode:element(QHK))
) -> lustre@vdom@vnode:element(QHK).
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(QHQ)),
list(lustre@vdom@vnode:element(QHQ))
) -> lustre@vdom@vnode:element(QHQ).
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(QHW)),
list(lustre@vdom@vnode:element(QHW))
) -> lustre@vdom@vnode:element(QHW).
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(QIC)),
list(lustre@vdom@vnode:element(QIC))
) -> lustre@vdom@vnode:element(QIC).
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(QII)),
list(lustre@vdom@vnode:element(QII))
) -> lustre@vdom@vnode:element(QII).
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(QIO)),
list(lustre@vdom@vnode:element(QIO))
) -> lustre@vdom@vnode:element(QIO).
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(QIU)),
list(lustre@vdom@vnode:element(QIU))
) -> lustre@vdom@vnode:element(QIU).
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(QJA)),
list(lustre@vdom@vnode:element(QJA))
) -> lustre@vdom@vnode:element(QJA).
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(QJG)),
list(lustre@vdom@vnode:element(QJG))
) -> lustre@vdom@vnode:element(QJG).
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(QJM)),
list(lustre@vdom@vnode:element(QJM))
) -> lustre@vdom@vnode:element(QJM).
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(QKC)),
list(lustre@vdom@vnode:element(QKC))
) -> lustre@vdom@vnode:element(QKC).
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(QKI)),
list(lustre@vdom@vnode:element(QKI))
) -> lustre@vdom@vnode:element(QKI).
reset(Attrs, Children) ->
lustre@element@html:button(
[lustre@attribute:class(<<"btn"/utf8>>),
lustre@attribute:type_(<<"reset"/utf8>>) |
Attrs],
Children
).