Basic Dark
The Basic Dark template is intended to be a neatly styled basic formatting template that is plug-and-play and doesn't require any frameworks or toolkits, etc. This formatting template is ready-to-go on "dark" pages and does not require any additional styling unless you wish to do so. You can place the CSS and JS inside the formatting template or add to your site's CSS / JS files.
Preview
Video: Preview of Formatting Template Examples
Formatting
{# Opening <form> tag #}
{{ form.renderTag }}
{# Display Success or Error banner and general errors if applicable #}
<div id="freeform-success-error-banner">
{% if not form.ajaxEnabled and form.submittedSuccessfully %}
<div class="freeform-form-success">
<p>{{ form.successMessage | t('freeform') }}</p>
</div>
{% endif %}
{% if form.hasErrors %}
<div class="freeform-form-errors">
<p>{{ form.errorMessage | t('freeform') }}</p>
{% if form.errors|length %}
<ul>
{% for error in form.errors %}
<li>{{ error }}</li>
{% endfor %}
</ul>
{% endif %}
</div>
{% endif %}
</div>
{# Render page tabs if multi-page #}
{% if form.pages|length > 1 %}
<ul class="freeform-pages">
{% for page in form.pages %}
<li {% if form.currentPage.index == page.index %}class="active"{% endif %}>
{{ page.label }}
</li>
{% endfor %}
</ul>
{% endif %}
{# Render form fields #}
{% for row in form %}
<div class="freeform-row {{ form.customAttributes.rowClass }}">
{% for field in row %}
{% set width = (12 / (row|length)) %}
{% set columnClass = "freeform-col-" ~ width %}
{% set columnClass = columnClass ~ form.customAttributes.columnClass %}
{% if field.type == "submit" or field.type == "save" %}
{% set columnClass = columnClass ~ " freeform-column-content-align-" ~ field.position %}
{% endif %}
<div class="{{ columnClass }} freeform-fieldtype-{{ field.type }}"{{ field.rulesHtmlData }}>
{% if field.type in ["checkbox", "mailing_list"] %}
{{ field.renderInput({ class: "freeform-input" ~ (field.hasErrors ? " is-invalid") }) -}}
{{- field.renderLabel({ labelClass: "freeform-label" ~ (field.inputOnly ? " freeform-input-only-label" : "") ~ (field.required ? " freeform-required" : "") }) }}
{{ field.renderInstructions({ instructionsClass: "freeform-instructions" }) }}
{{ field.renderErrors({ errorClass: "freeform-errors" }) }}
{% else %}
{{ field.render({
class: field.type not in ["submit", "save", "signature"] ? "freeform-input" : "",
labelClass: "freeform-label" ~ (field.inputOnly ? " freeform-input-only-label" : "") ~ (field.required ? " freeform-required" : ""),
errorClass: "freeform-errors",
instructionsClass: "freeform-instructions",
}) }}
{# FOR FREEFORM PAYMENTS #}
{% if field.layoutRows is defined %}
{% for layoutRow in field.layoutRows %}
<div class="freeform-row freeform-payments {{ form.customAttributes.rowClass }}">
{% for layoutField in layoutRow %}
{% set layoutWidth = (12 / (layoutRow|length)) %}
{% set paymentColumnClass = "freeform-col-" ~ layoutWidth %}
<div class="{{ paymentColumnClass }}">
{{ layoutField.render({
class: "freeform-input",
labelClass: "freeform-label" ~ (layoutField.inputOnly ? " freeform-input-only-label" : "") ~ (layoutField.required ? " freeform-required" : ""),
errorClass: "freeform-errors",
instructionsClass: "freeform-instructions",
}) }}
</div>
{% endfor %}
</div>
{% endfor %}
{% endif %}
{% endif %}
</div>
{% endfor %}
</div>
{% endfor %}
{# Closing </form> tag #}
{{ form.renderClosingTag }}
CSS
The following CSS is a supplemental starting point to get forms appearing robustly.
/* LAYOUT */
.freeform-form-container {
font-family: sans-serif;
}
.freeform-row::after {
content: '';
clear: both;
display: block;
}
[class*='freeform-col-'] {
float: left;
padding: 15px;
}
/* BUTTONS */
button {
font: 400 18px sans-serif;
line-height: 1.5;
color: #ffffff;
text-align: center;
text-decoration: none;
border: 1px solid #0d6efd;
border-radius: 5px;
background-color: #0d6efd;
padding: 5px 15px;
margin-right: 10px;
cursor: pointer;
display: inline-block;
vertical-align: middle;
transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out,
border-color 0.15s ease-in-out;
justify-content: center;
}
button:only-child,
button:last-child {
margin-right: 0;
}
button:hover {
color: #ffffff;
background-color: #0b5ed7;
border-color: #0a58ca;
}
button[data-freeform-action='back'] {
font: 400 18px sans-serif;
color: #6c757d;
background-color: transparent;
border-color: #6c757d;
}
button[data-freeform-action='back']:hover {
color: #ffffff;
background-color: #6c757d;
border-color: #6c757d;
}
button[type='submit'].ff-loading {
display: inline-flex;
flex-wrap: nowrap;
align-items: center;
}
button[type='submit'].ff-loading:before {
content: '';
display: block;
flex: 1 0 11px;
width: 11px;
height: 11px;
margin-right: 10px;
border-style: solid;
border-width: 2px;
border-color: transparent transparent #fff #fff;
border-radius: 50%;
animation: ff-loading 0.5s linear infinite;
}
@keyframes ff-loading {
0% {
transform: rotate(0);
}
100% {
transform: rotate(1turn);
}
}
/* PAGE TABS */
.freeform-pages {
display: flex;
padding: 0;
margin: 0 0 25px 0;
list-style: none;
border-bottom: 2px solid #dddddd;
}
.freeform-pages li {
color: #6c757d;
background: transparent;
padding: 10px 20px;
margin: 0;
}
.freeform-pages li.active {
color: black;
font-weight: bold;
background: #dddddd;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
}
/* FORM LAYOUT */
.freeform-row {
font: normal 16px sans-serif;
color: #eaeaea;
justify-content: space-between;
padding: 0;
margin: 0;
}
.freeform-row [class*='freeform-col-'] {
flex: 1 0;
padding: 10px;
margin: 0;
box-sizing: border-box;
}
.freeform-row [class*='freeform-col-'] > .freeform-row:first-child {
margin-top: -10px;
}
.freeform-row [class*='freeform-col-'] label {
display: block;
margin: 0 0 5px 0;
}
.freeform-row [class*='freeform-col-'] .freeform-input[type='checkbox'],
.freeform-row [class*='freeform-col-'] .freeform-input[type='radio'] {
margin-right: 10px;
width: auto;
display: inline;
transform: scale(1.15);
}
.freeform-row
[class*='freeform-col-']
label:has(> .freeform-input[type='checkbox'].freeform-has-errors),
.freeform-row
[class*='freeform-col-']
label:has(> .freeform-input[type='radio'].freeform-has-errors),
.freeform-row
[class*='freeform-col-'].freeform-fieldtype-checkbox_group:has(
ul.freeform-errors
)
label:not(:first-child),
.freeform-row
[class*='freeform-col-'].freeform-fieldtype-checkbox_group:has(
ul.freeform-errors
)
div.input-group-one-line
label,
.freeform-row
[class*='freeform-col-'].freeform-fieldtype-radio_group:has(
ul.freeform-errors
)
label:not(:first-child),
.freeform-row
[class*='freeform-col-'].freeform-fieldtype-radio_group:has(
ul.freeform-errors
)
div.input-group-one-line
label {
color: #dc3545 !important;
}
.freeform-row [class*='freeform-col-'] .input-group-one-line {
display: flex;
flex-wrap: wrap;
}
.freeform-row [class*='freeform-col-'] .input-group-one-line label {
padding-right: 15px;
}
.freeform-row
[class*='freeform-col-']
.input-group-one-line
label
input[type='radio'],
.freeform-row
[class*='freeform-col-']
.input-group-one-line
label
input[type='checkbox'] {
margin-right: 10px;
display: inline-block;
transform: scale(1.15);
}
.freeform-row [class*='freeform-col-'] .freeform-label {
font-weight: 400;
}
.freeform-row [class*='freeform-col-'] .freeform-label.freeform-required:after {
content: '*';
margin-left: 5px;
color: #dc3545;
}
.freeform-row.freeform-payments {
margin: -10px;
}
/* BASIC FIELD STYLES */
.freeform-row [class*='freeform-col-'] input,
.freeform-row [class*='freeform-col-'] .freeform-input.StripeElement,
.freeform-row [class*='freeform-col-'] textarea,
.freeform-row [class*='freeform-col-'] select {
box-sizing: border-box;
font: normal 16px sans-serif;
color: #eaeaea;
background-color: #1d1f23;
border: 1px solid #6c757d;
border-radius: 5px;
padding: 10px;
width: 100%;
display: block;
resize: none;
transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out,
border-color 0.15s ease-in-out;
}
.freeform-row [class*='freeform-col-'] select:not(select[multiple]) {
background-image: linear-gradient(45deg, transparent 50%, #6c757d 50%),
linear-gradient(135deg, #6c757d 50%, transparent 50%), linear-gradient(to
right, #6c757d, #6c757d);
background-position: calc(100% - 20px) calc(1em + 2px), calc(100% - 15px) calc(
1em + 2px
), calc(100% - 2.5em) 0.5em;
background-size: 5px 5px, 5px 5px, 1px 1.5em;
background-repeat: no-repeat;
appearance: none;
-webkit-appearance: none;
-moz-appearance: none;
}
.freeform-row [class*='freeform-col-'] input:focus,
.freeform-row [class*='freeform-col-'] .freeform-input.StripeElement--focus,
.freeform-row [class*='freeform-col-'] textarea:focus,
.freeform-row [class*='freeform-col-'] select:focus {
border: 1px solid #0b5ed7;
outline: 0;
transition: border-color 0.15s ease-in-out;
}
.freeform-row [class*='freeform-col-'] input::placeholder,
.freeform-row [class*='freeform-col-'] textarea::placeholder {
font: normal 16px sans-serif;
color: #6c757d;
}
.freeform-row [class*='freeform-col-'] input.freeform-has-errors,
.freeform-row [class*='freeform-col-'] .freeform-input.StripeElement--invalid,
.freeform-row [class*='freeform-col-'] textarea.freeform-has-errors,
.freeform-row [class*='freeform-col-'] select.freeform-has-errors,
.freeform-row [class*='freeform-col-'] input:has(+ ul.freeform-errors),
.freeform-row [class*='freeform-col-'] textarea:has(+ ul.freeform-errors),
.freeform-row [class*='freeform-col-'] select:has(+ ul.freeform-errors) {
border: 1px solid #dc3545;
}
.freeform-row [class*='freeform-col-'] .freeform-input-only-label {
font-weight: normal;
}
.freeform-row
[class*='freeform-col-']
.freeform-input-only-label
> .freeform-input {
display: inline-block;
width: auto;
margin-right: 10px;
}
.freeform-row [class*='freeform-col-'] .freeform-errors,
.freeform-row [class*='freeform-col-'] .ff-errors {
margin: -5px 0 0 0;
padding: 0;
list-style: none;
display: block;
width: 100%;
}
.freeform-row
[class*='freeform-col-'].freeform-fieldtype-radio_group
.freeform-errors,
.freeform-row
[class*='freeform-col-'].freeform-fieldtype-radio_group
.ff-errors,
.freeform-row
[class*='freeform-col-'].freeform-fieldtype-checkbox_group
.freeform-errors,
.freeform-row
[class*='freeform-col-'].freeform-fieldtype-checkbox_group
.ff-errors {
margin-top: 0;
}
.freeform-row [class*='freeform-col-'] .freeform-errors > li,
.freeform-row [class*='freeform-col-'] .ff-errors > li {
font: italic 400 15px sans-serif;
color: #dc3545;
margin-top: 10px;
}
.freeform-row [class*='freeform-col-'] .freeform-errors > li:not(:first-child),
.freeform-row [class*='freeform-col-'] .ff-errors > li:not(:first-child) {
margin-top: 3px;
}
.freeform-row [class*='freeform-col-'] .freeform-instructions {
font-size: 13px;
color: #6c757d;
margin: -5px 0 10px 0;
}
/* SINGLE CHECKBOX FIELDS */
.freeform-row [class*='freeform-col-'].freeform-fieldtype-checkbox label,
.freeform-row [class*='freeform-col-'].freeform-fieldtype-mailing_list label {
display: inline-block;
margin: 0 0 10px 0;
}
.freeform-row
[class*='freeform-col-'].freeform-fieldtype-checkbox
input[type='checkbox'],
.freeform-row
[class*='freeform-col-'].freeform-fieldtype-mailing_list
input[type='checkbox'] {
margin-right: 10px;
width: auto;
display: inline-block;
transform: scale(1.15);
}
.freeform-row
[class*='freeform-col-'].freeform-fieldtype-checkbox
input.freeform-has-errors
+ label,
.freeform-row
[class*='freeform-col-'].freeform-fieldtype-checkbox
label:has(+ ul.freeform-errors),
.freeform-row
[class*='freeform-col-'].freeform-fieldtype-checkbox
label:has(+ div + ul.freeform-errors) {
color: #dc3545 !important;
}
/* OPINION SCALE FIELDS */
.freeform-fieldtype-opinion_scale .opinion-scale-scales {
border: 1px solid #6c757d;
border-radius: 5px;
}
.freeform-fieldtype-opinion_scale .opinion-scale-scales li label {
color: #eaeaea !important;
background-color: #1d1f23;
border: 0;
border-left: 1px solid #6c757d;
padding: 10px 15px;
margin: 0;
cursor: pointer;
}
.freeform-fieldtype-opinion_scale .opinion-scale-scales li:first-child label {
border: 0;
border-left: 0;
border-top-left-radius: 3px;
border-bottom-left-radius: 3px;
}
.freeform-fieldtype-opinion_scale .opinion-scale-scales li label:hover {
background-color: #141619;
}
.freeform-fieldtype-opinion_scale input[type='radio']:checked + label {
background-color: #535760;
}
.freeform-fieldtype-opinion_scale
.opinion-scale-scales:has(> li input.freeform-has-errors),
.freeform-fieldtype-opinion_scale
.opinion-scale:has(+ ul.freeform-errors)
.opinion-scale-scales {
border: 1px dashed #dc3545;
}
.freeform-fieldtype-opinion_scale .opinion-scale-legends li {
font: normal 15px sans-serif;
color: #6c757d;
padding: 10px 0;
margin-top: 0;
}
/* RATING FIELDS */
.freeform-fieldtype-rating .freeform-has-errors + label:not(:first-child),
.freeform-fieldtype-rating div:has(+ ul.freeform-errors) label {
color: #dc3545;
}
.form-rating-field-wrapper input[type='radio'] + label {
margin-right: 5px;
}
/* FILE UPLOAD DRAG & DROP FIELDS */
.freeform-file-drag-and-drop {
background-color: #1d1f23 !important;
border: 1px dashed #6c757d !important;
}
.freeform-file-drag-and-drop input {
display: none !important;
}
.freeform-file-drag-and-drop__placeholder {
font: italic 200 16px sans-serif !important;
color: #6c757d;
}
.freeform-file-drag-and-drop [data-messages] > li[data-error],
.freeform-file-drag-and-drop [data-field-errors] > li[data-error] {
font: 200 16px sans-serif;
color: #dc3545;
margin-top: 15px;
}
.freeform-file-drag-and-drop [data-field-errors] > li {
color: #dc3545;
}
/* SIGNATURE FIELDS */
.freeform-fieldtype-signature button {
font: 400 16px sans-serif;
color: #ffffff;
border: 1px solid #6c757d;
background-color: transparent;
}
.freeform-fieldtype-signature button:hover {
color: #fff;
background-color: #6c757d;
border-color: #6c757d;
}
.freeform-fieldtype-signature canvas {
border: 1px solid #6c757d;
border-radius: 5px;
}
/* TABLE FIELDS */
.freeform-fieldtype-table table {
width: 100%;
font: 400 14px sans-serif;
text-align: left;
}
.freeform-fieldtype-table table thead tr th {
padding-bottom: 10px;
}
.freeform-fieldtype-table table tbody tr:only-child button {
display: none;
}
.freeform-fieldtype-table table tbody tr td {
padding: 0 10px 10px 0;
}
.freeform-fieldtype-table table tbody tr td:last-child {
text-align: right;
padding-right: 0;
}
.freeform-fieldtype-table table button[data-freeform-table-remove-row] {
font-size: 1px;
margin: 0;
padding: 0;
visibility: hidden;
}
.freeform-fieldtype-table table button[data-freeform-table-remove-row]:after {
font: 400 14px sans-serif;
color: #b02a37;
line-height: 1.5;
content: '✕';
border: 1px solid #b02a37;
border-radius: 5px;
padding: 5px 15px;
display: inline-block;
vertical-align: middle;
cursor: pointer;
visibility: visible;
transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out,
border-color 0.15s ease-in-out;
}
.freeform-fieldtype-table
table
button[data-freeform-table-remove-row]:hover:after {
color: #ffffff;
background-color: #b02a37;
border-color: #b02a37;
}
.freeform-fieldtype-table button[data-freeform-table-add-row] {
font: 400 14px sans-serif;
line-height: 1.5;
color: #146c43;
content: '+';
border: 1px solid #146c43;
background-color: transparent;
margin: 0;
}
.freeform-fieldtype-table button[data-freeform-table-add-row]:hover {
color: #ffffff;
background-color: #146c43;
border-color: #146c43;
}
.freeform-fieldtype-table button[data-freeform-table-add-row]:after {
content: '+';
margin-left: 5px;
}
.freeform-fieldtype-table input[type='checkbox'] {
display: block;
transform: scale(1.15);
}
.freeform-fieldtype-table select {
min-width: 200px;
}
/* SUBMIT BUTTON ALIGNMENT */
.freeform-row [class*='freeform-col-'].freeform-column-content-align-left {
display: flex;
justify-content: flex-start;
}
.freeform-row
[class*='freeform-col-'].freeform-column-content-align-left
> button:not(:first-of-type) {
margin-left: 5px;
}
.freeform-row [class*='freeform-col-'].freeform-column-content-align-center {
display: flex;
justify-content: center;
}
.freeform-row
[class*='freeform-col-'].freeform-column-content-align-center
> button:not(:first-of-type) {
margin-left: 5px;
}
.freeform-row [class*='freeform-col-'].freeform-column-content-align-right {
display: flex;
justify-content: flex-end;
}
.freeform-row
[class*='freeform-col-'].freeform-column-content-align-right
> button:not(:first-of-type) {
margin-left: 5px;
}
.freeform-row [class*='freeform-col-'].freeform-column-content-align-spread {
display: flex;
justify-content: space-between;
}
.freeform-row
[class*='freeform-col-'].freeform-column-content-align-spread
> button:not(:first-of-type) {
margin-left: 5px;
}
/* ERRORS AND SUCCESS */
.freeform-form-success,
.freeform-form-errors {
margin-left: auto;
margin-right: auto;
margin-bottom: 20px;
padding: 15px 20px;
border-radius: 5px;
}
.freeform-form-success p,
.freeform-form-errors p {
font: normal 18px sans-serif;
color: #ffffff;
margin: 0;
}
.freeform-form-success ul,
.freeform-form-errors ul {
font: italic 15px sans-serif;
color: #ffffff;
margin: 10px 0 0 0;
padding: 0 0 0 25px;
}
.freeform-form-success ul li:not(:last-child),
.freeform-form-errors ul li:not(:last-child) {
margin-bottom: 5px;
}
.freeform-form-success {
background-color: #198754;
border: 1px solid #198754;
}
.freeform-form-errors {
background-color: #dc3545;
border: 1px solid #dc3545;
}
/* RESPONSIVE GRID */
@media only screen and (max-width: 800px) {
[class*='freeform-col-'] {
width: 100%;
}
}
@media only screen and (min-width: 801px) {
.freeform-col-1 {
width: 8.33%;
}
.freeform-col-2 {
width: 16.66%;
}
.freeform-col-3 {
width: 25%;
}
.freeform-col-4 {
width: 33.33%;
}
.freeform-col-5 {
width: 41.66%;
}
.freeform-col-6 {
width: 50%;
}
.freeform-col-7 {
width: 58.33%;
}
.freeform-col-8 {
width: 66.66%;
}
.freeform-col-9 {
width: 75%;
}
.freeform-col-10 {
width: 83.33%;
}
.freeform-col-11 {
width: 91.66%;
}
.freeform-col-12 {
width: 100%;
}
}
JS
The following JS is a supplemental starting point to handle additional elements in the form.
// Adjustments for Success and Errors classes
document.addEventListener('freeform-ready', function (event) {
event.options.errorClassBanner = 'freeform-form-errors';
event.options.errorClassList = 'freeform-errors';
event.options.errorClassField = 'freeform-has-errors';
event.options.successClassBanner = 'freeform-form-success';
});
// Styling for Stripe Payments field
document.addEventListener('freeform-stripe-styling', function (event) {
(event.detail.base = {
fontSize: '16px',
color: '#eaeaea',
fontFamily:
'-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji"',
'::placeholder': {
color: '#6c757d',
},
}),
(event.detail.invalid = {
color: '#dc3545',
});
});
Live Demo
The demo below is a live demo site that shows most of what the Demo Templates include (some sections and data has been limited).