Skip to content

Blade Semantic UI Template

Fatih Kececi edited this page Jul 19, 2016 · 2 revisions

The following view files will get you started with a basic Semantic UI Menu using the Blade template engine.


navbar.blade.php

Recommended save to views/partials/menu.

<div class="ui menu">
    @include('partials.menu.items', ['items'=> $menu_example->roots()])
</div>

items.blade.php

Recommended save to views/partials/menu.

@foreach($items as $item)
    @if(!$item->hasChildren())
        @if($item->link)
            <a class="item" href="{!! $item->url() !!}">
                {!! $item->title !!}
            </a>
        @else
            {!!$item->title!!}
        @endif
    @else
        <div class="ui dropdown item">
            {!!$item->title!!} <i class="dropdown icon"></i>

            <div class="menu">
                @foreach($item->children() as $child)
                    <a href="{!! $child->url() !!}" class="item">{!! $child->title !!}</a>
                    @if($child->divider)
                        <div{!!\HTML::attributes($child->divider)!!}></div>
                    @endif
                @endforeach
            </div>
        </div>
    @endif
@endforeach