It’s been a little over a year since we released the Repeatable Fieldset into the wild. Since then, we’ve received many questions about how one would create multi-column layouts using repeating fields. Today I will answer that question and show you how to create multi-column layouts for repeaters using our helper classes.
Are you ready? Let’s begin!
Constructing a multi-column layout with repeaters is easy and only takes two steps. First, add the Repeatable Fieldset and any field you would like repeated to your form. After that, add helper classes to the Repeating Fieldset itself. That’s it, easy peasy.
As mentioned above, add the Repeatable Fieldset to your form. You can do this by clicking the blue/+ icon at the bottom right and then clicking on the Repeatable Fieldset. Next, add any field you would like to be included in the repeater.
Open the Display dropdown. Look for the Custom Class Names section. In this section, you will see two fields. One is called CONTAINER, and the other is called ELEMENT. In the CONTAINER field, enter the custom classes to create your multi-column layout.
✨ FYI – If you are using Layout and Styles to style other fields, the Helper Classes will not work. As a workaround you can add the following CSS to the WordPress Customizer ( Appearance > Customize > Additional CSS ).
.nf-repeater-fieldset nf-field float:left;
padding-right:15px;
width:33%;
>
The core version of Ninja Forms includes custom helper classes to assist you in creating column layouts. The good news is these helper classes can be used to arrange the repeating fields side-by-side. Offering more control to display the repeating fields horizontally instead of vertically.
To begin, start by making a row by adding the ” first ” class into the CONTAINER field of the Custom Class Names. To set the width of the row, add a second class, and that’s it.
First, add the helper class of “first” to the CONTAINER field of the first repeating field in your row. Second, add another class called “one-half” to that same CONTAINER field. Third, add the class “one-half” to any remaining fields. After that wash and repeat to ensure all fields include the “one-half” width class.
After that, if you do it right, your repeating fields will display in two columns side-by-side.
First, add the helper class of “first” to the CONTAINER field of the first repeating field in your row. Second, add another class called “one-third” to that same CONTAINER field. Third, add the class “one-third” to any other remaining fields. After that, wash and repeat to ensure all fields include the “one-third” width class.
If you do it right, your repeating fields will display in three columns side-by-side.
Now that you know how to use the Ninja Form helper classes to turn your Repeatable Fieldset into a horizontal work of art, it’s your turn.
Add repeaters to your WordPress form for free with the core Ninja Forms plugin. Unlike our competitors, our core plugin includes features like unlimited forms, unlimited form submissions, submission exports, custom email notifications, spam protection, shareable links, and more. All for free!
Get exclusive content, tips and offers delivered to your inbox.