freedive/lib/freedive_web/components/liliform.ex

23 lines
513 B
Elixir

defmodule Liliform do
use Phoenix.Component
import PhxComponentHelpers
@doc """
Renders a button.
"""
slot :inner_block, required: true
def button(assigns) do
assigns =
assigns
|> extend_class("bg-blue-500 text-white px-4 py-2 rounded-md")
|> set_attributes([:type, :id], required: [:id])
|> set_phx_attributes()
~H"""
<button {@heex_id} {@heex_type} {@heex_phx_attributes} {@heex_class}>
<%= render_slot(@inner_block) %>
</button>
"""
end
end