I figured it out, this is the solution I used:
<%= text_input f, :name, placeholder: "Name", class: "
#{if @changeset.errors[:name] && @change_action,
do: "border-red-600 focus:border-red-600 focus:ring-2 focus:ring-red-600 focus:ring-opacity-50 dark:border-red-500",
else: "border-gray-400 dark:border-gray-500 focus:border-gray-900 dark:focus:border-gray-300 focus:ring-2 focus:ring-gray-500 focus:ring-opacity-50"}
rounded dark:bg-zinc-800 transition duration-150" %>
<%= error_tag f, :name %>
Not sure whether to delete this post or leave it in case others are searching for the same solution. Leaving it unless somebody suggests that I delete it!