Current section
Files
Jump to
Current section
Files
src/docs@components@hello_button.erl
-module(docs@components@hello_button).
-compile([no_auto_import, nowarn_unused_vars]).
-export([hello_button/2]).
-export_type([hello_button_props/0]).
-type hello_button_props() :: {hello_button_props,
gleam@option:option(binary())}.
-spec hello_button(sprocket@context:context(), hello_button_props()) -> {sprocket@context:context(),
list(sprocket@context:element())}.
hello_button(Ctx, Props) ->
{hello_button_props, Label} = Props,
sprocket@component:render(
Ctx,
[sprocket@html:button(
[sprocket@html@attributes:class(
<<"p-2 bg-blue-500 hover:bg-blue-600 active:bg-blue-700 text-white rounded"/utf8>>
)],
[sprocket@html:text(case Label of
{some, Label@1} ->
Label@1;
none ->
<<"Click me!"/utf8>>
end)]
)]
).