Log1x/navi

Nav items with Icons

fabianwurk opened this issue · 4 comments

Brandon, is there a way to add different icons beside nav items using Navi (ps. currently using Tailwind so trying to avoid using css pseudo classes). Thanks

Log1x commented

If you're using ACF, the easy way would be the just add a menu icon field to the navigation items.

$menu = new FieldsBuilder('menu');

$menu->setLocation('nav_menu_item', '==', 'location/primary_navigation');

$menu->addText('menu_icon');

and then in your Navigation blade view loop, you can just get_field the menu item ID:

get_field('menu_icon', $item->id)
Log1x commented

That was just a dummy example using https://github.com/Log1x/acf-composer

You can add the field however you add field groups (assuming you're using ACF)