defmodule DaisyUIComponents.ButtonGroup do @moduledoc """ Button Group component https://daisyui.com/components/button-group/ """ use DaisyUIComponents.Component @doc """ Renders a button group. ## Examples <.button_group> <.button active>Button <.button>Button <.button>Button """ attr :class, :string, default: nil attr :direction, :string, values: directions() attr :rest, :global slot :inner_block, required: true def button_group(assigns) do assigns = assign(assigns, :class, [ "btn-group", btn_group_direction(assigns[:direction]), assigns.class ]) ~H"""
<%= render_slot(@inner_block) %>
""" end # Direction defp btn_group_direction("vertical"), do: "btn-group-vertical" defp btn_group_direction("horizontal"), do: "btn-group-horizontal" defp btn_group_direction(_direction), do: nil end