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)
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
Environment
Actual behavior
When using components from core components, some of them don't accept custom classes. (in this example, the
.form
accepts new classes but.label
and.input
no)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