We've retired the forum in favor of GitHub Discussions.

New conversations can be started on GitHub. Existing conversations will remain for a while longer.

Head over to GitHub →

Adding class to <input>s in forms

Jakub Tomek October 20, 2020 by Jakub Tomek

Hello everybody,

How to add a class to the {{ field }} directly in the template (I don't want to publish the templates)?

{{ fields }}
    <div class="p-2">
        <label>{{ display }}</label>
        <div class="p-1">{{ field }}</div>
        {{ if error }}
            <p class="text-gray-500">{{ error }}</p>
        {{ /if }}
{{ /fields }}

This works for forms:

{{ form:apply class="bg-white shadow-md rounded px-8 pt-6 pb-8 mb-4" }}

Source: Docs

EDIT - Just figured out a workaround (really don't want to publish the templates)

Set the following as a placeholder value from the CP (mind the quotation marks)

Your email" class="shadow w-full py-2 px-3

>>>>>>> Unanswered <<<<<<<
1 Reply