Self-Configuring Foundation Menu Layouts

Save time with a reusable menu layout to dynamically configure a menu for Foundation's 3 menu types; Dropdown, Drilldown, and Accordion.

  1. Foundation's menu types require you to set both classes and data attributes to your menu markup.

    By simply adding the required Foundation data attribute to a custom menuType parameter in Menu component tag, the following layout code will configure the menu markup for use with Foundation.

    you can swap and change the menu type as needed, or dynamically set this based on device type or other conditions.

    Optionally, you can add additional classes to the menu via the custom menuClasses parameter (for additional styling such as 'align-center'. You do not need to add Foundation's menu type classes here):

    <!--Treehouse CODE v1.0.0-->
    {% component type: "menu", alias: "main-menu", layoutGroup: "Default", menuType: "data-drilldown", menuClasses: "align-center" %}
  2. Now, add the below code to the 'menu' layout in your Menus layout group:

    <!--Treehouse CODE v1.0.0-->
    <ul class="menu icons  "  data-options="multiOpen:false;">
  3. Finally, add the below code to the 'sub_items' layout in your Menus layout group to correctly configure sub menu items for Foundation's markup requirements:

    <!--Treehouse CODE v1.0.0-->

Comments or questions? Head over to the Treepl CMS forum to discuss with the community.