freedive/lib/liliform/button.ex

24 lines
499 B
Elixir

defmodule Liliform.Button do
use Liliform.Component
@doc """
Renders button.
"""
attr :type, :string, default: "button", doc: "button type"
attr :class, :string, default: "", doc: "additional classes"
attr :rest, :global
slot :inner_block, required: true
def button(assigns) do
assigns =
assigns
|> set_bulma_classes()
~H"""
<button class={["button", @class]} type={@type} {@rest}>
<%= render_slot(@inner_block) %>
</button>
"""
end
end