phoenixframework / phoenix

Peace of mind from prototype to production
https://www.phoenixframework.org
MIT License
21.46k stars 2.88k forks source link

Some tags of core components don't accept custom classes #5886

Closed ThiagoMonaco closed 3 months ago

ThiagoMonaco commented 3 months ago

Environment

Actual behavior

When using components from core components, some of them don't accept custom classes. (in this example, the .formaccepts new classes but .label and .input no) CleanShot 2024-07-30 at 19 50 13

defmodule ChatWeb.CreateAccount.CreateAccountLive do
  alias Chat.Accounts
  alias Chat.Accounts.Account
  use ChatWeb, :live_view 

  def mount(_params, _session, socket) do
    changeset = Accounts.change_account(%Account{})
    {:ok, assign(socket, :form, to_form(changeset))}
  end

  def render(assigns) do
    ~H"""
      <div class="container">
        <h1 class="text-center text-4xl font-bold tracking-tight text-gray-900 sm:text-6xl">
          Account Creation
        </h1>
        <.form 
          class="flex w-full items-center flex-col mt-10 text-xl"
          for={@form}>
            <div class="flex w-1/2 justify-center flex-col ">
              <.label class="bg-red-800" for="name">Name</.label>
              <.input class="mt-3 bg-blue-600" field={@form[:name]} placeholder="Name" />
            </div>
        </.form>
      </div>
    """
  end
end

Expected behavior

The class "bg-red-800" to be appended with default classes of .label The class "mt-3 bg-blue-600" to be appended with default classes of .input

chrismccord commented 3 months ago

https://github.com/phoenixframework/phoenix/pull/5887#issuecomment-2259426438