Day(s)

:

Hour(s)

:

Minute(s)

:

Second(s)

Creating a Divi MadMenu Header. Part 5: Search Form

by | Oct 31, 2021 | 0 comments

This is the final part of the tutorials series in which we’ve been creatng the Divi MadMenu header template #13.

In this tutorial we are going to add the Search form to the header which will be sliding in from top from “behind” the main menu bar when the user clicks the search icon on the left side of the header.

If you haven’t done the previous tutorials (Part 1, Part 2, Part 3 and Part 4) I highly recommend you to do them first and then continue with this one.

However, you can also download the header template that we’ve done in Part 4, import it into the Theme Builder and follow this tutorial from where we left in the previous part.

Adding the Search Form

Search form is a popup and works much like the horizontal slide-in menu that we’ve created in Part 2.

However, this time we will not use just a module but a row to create the header search form that will slide in from top on search icon click.

Let’s add this row with the Search module into the same section which contains the row with the main menu bar, the horizontal slide-in menu and the login popup.

  1. Add the row.
  2. Add the Search module.

First, let’s set the row sizing in Row Settings -> Design -> Sizing:

  1. Set the row width to 80% for Desktop.
  2. Set the row max-width to 800px.
  3. Set the row width to 100% for Phone.

Let’s also adjust the row spacing in Row Settings -> Design -> Spacing.

Similar to the horizontal slide-in menu, we need to make sure the search form does not get covered by the main menu bar.

So, we need to apply top margin to the row equal to the height of the main menu bar.

Also, on desktop and tablet there needs to be a gap between the main menu bar and the opened search form. We will add this gap using the row padding-top.

  1. Set the row margin-top to 75px on Desktop.
  2. Set the row padding for Desktop and Tablet: 20px 0px 0px 0px.
  3. Set the row margin-top to 65px on mobile(both Tablet and Phone).
  4. Set the row padding for Phone: 0px 0px 0px 0px.

Now let’s add a unique ID to this row which will be used to create the search slide-in popup later in this tutorial:

  1. Add an ID to the row: searchForm (use a unique ID here, the one we used is for demonstration purposes only).

Adding the Search Button

The next step is adding the search toggle button(the search icon) to the header.

We’ll add the search icon using the same MadMenu module that we’ve used for creating the social icons toggle in Part 4.

For the social icons toggle we’ve used the Button One element of Divi MadMenu module, so, for the search toggle let’s use the Button Two element.

  1. Open the Layer view.
  2. Open the Divi MadMenu module settings (the one that we’ve used to create the social icons toggle).
  3. Enable the Button Two element which will be the search toggle.
  4. Update the module admin label to reflect the changes(optional).

As you can see in the screenshot above, the search toggle button is not aligned properly, we need it to be aligned horizontally to the right of the social icons button.

That’s because the module is applied a width of 50px and we need to increase that so that both buttons fit horizontally.

To do that let’s go to Design -> Sizing settings of Divi MadMenu module and change the module width and max-width to 105px:

Now let’s add the Button Two content, assign it the popup ID that we’ve added to the search row (searchForm), and apply the popup settings to make the search form slide-in/out on the search button click in MadMenu Settings -> Content -> Button Two:

  1. Leave the button text empty.
  2. Enable the icon and set the icon type to Image Icon.
  3. Add the image icon.
  4. Set the button type to Popup.
  5. Set the popup ID: searchForm.
  6. The toggle type must be Primary.
  7. Set the popup location to Top Center.
  8. Set the opening animation to Slide In Top.
  9. Set the closing animation to Slide Out Top.
  10. Make the search form hides when the user clicks outside.
  11. Set the z-index to 1(one), we need the search form to go “behind” the main menu bar when closed.

To style the search toggle go to Design -> Button Two, it should have the same styling as the social icons toggle button:

  1. Set the margin: 0px 0px 10px 0px.
  2. Set the background color: rgba(255, 255, 255, 0.15), hover background color should be rgba(255, 255, 255, 0.25).
  3. Make the toggle button circular by applying a 50px border radius.
  4. Set the image icon width to 20px.
  5. Remove the button border: 0px.

The search toggle is now ready and is working(if you click it the search form will slide in/out). Next, let’s style the search form.

Styling the Search Form

This part is optional, you can apply any design you want, but we’ll style it similarly to the overall design of the header.

So, let’s go to the Search module content settings and add the content:

  1. Add the placeholder text: Search… (Search Settings -> Content -> Text).
  2. Enable the search form button for Desktop and Tablet (Search Settings -> Content -> Elements).
  3. Disable the search form button for Phone (Search Settings -> Content -> Elements).

Next, go to the Search Settings -> Design -> Field and Search Settings -> Design -> Button Text sections and apply these settings:

  1. Placeholder text color: rgba(255, 255, 255, 0.85).
  2. Field background color: #002366.
  3. Field text color: #ffffff.
  4. Field focus background color: #002366.
  5. Field focus text color: #ffffff.
  6. Field font: Montserrat.
  7. Field font weight: Medium.
  8. Field text size: 16px.
  9. Button and Border color: #fa8072.
  10. Button font: Montserrat.
  11. Button text color: #ffffff.

You can also make the button font semi-bold and uppercase.

Finally, let’s adjust the search form spacing, sizing and border settings:

  1. Width: 100%.
  2. Padding: 14px 14px 19px 15px.
  3. Border radius for Desktop and Tablet: 2px.
  4. Border width: 0px.
  5. Border readius for Phone: 0px.

And that’s it, the search form is ready.

Wrapping Up

In this tutorial we’ve added the search form to the header we’ve been creating throughout this tutorials series.

The header search form slides in and out when the user clicks the search button on the left side of the header.

This was the last part of the header that we needed to create, the final version of this header template is available with the Divi MadMenu extension, it’s the demo header template #13.

Hope you’ve learned a lot about how to use the Divi MadMenu and get the most out of it while creating this header template step by step. If you have any thoughts and suggestions feel free to share them in the comments section below.

View Live Demos & Get Divi MadMenu

Download FREE Divi Sections

Subscribe To Our Newsletter

Join our mailing list to download Divi freebies and get notified of our discounts, latest news and updates.

You have Successfully Subscribed! Please confirm your email address.

Divi MadMenu Coming Soon!

Join our mailing list to get notified when the Divi MadMenu module is released! Check out the sneak peek...

You have Successfully Subscribed! Please confirm your email address.

Free Download Divi Section Layouts

Download 19 ready-to-use Divi templates for FREE!

You have Successfully Subscribed! Please confirm your email address.

Black Friday Is Coming!

Subscribe to get notified when the biggest SALE starts!

You have Successfully Subscribed! Please confirm your email address.

Pin It on Pinterest

Share This