Navbar

The navbar component is a traditional navbar with link items. In smaller screen sizes it becomes an expandable menu. You can load all the nav items with an array directly on the creation of the component. To load items dynamically as the user traverses down the tree of sub menu items is also an option. This is done with javascript and a request to a JSON file.

Navbar border top

Navigation with a bar and border on the top

<!-- navbar.blade.php -->
<nav class="c-navbar u-position--relative c-navbar--border-top" data-uid="673ed2838d288">
    <div class="c-navbar__toggle">
            <!-- icon.blade.php -->
    <span class="c-icon c-icon--menu c-icon--material c-icon--material-menu material-symbols material-symbols-rounded material-symbols-sharp material-symbols-outlined  c-icon--size-xl" js-sidebar-trigger="" material-symbol="menu" role="img" data-nosnippet="" translate="no" aria-label="Icon: Undefined" alt="Icon: Undefined" aria-hidden="false" data-uid="673ed2838d366">
                    </span>
    </div>

    
    <div class="c-navbar__logo">
        <a href="/">
                <!-- image.blade.php -->
<figure class="c-image c-image--type-svg" data-uid="673ed2838d3c9">
     
        <img src="/assets/img/logotype.svg" alt="A logo" class="c-image__image" />
            </figure>

        </a>
    </div>
    
    <div class="c-navbar__list">
                    
                
                    <a 
                href="#" 
                aria-label="About" 
                item-ancestor="" 
                item-active=""
                item-has-children=""
                item-children-async=""
            >
                <div class="c-navbar__item">
                    <span>About</span>
                </div>
            </a>
                    <a 
                href="#" 
                aria-label="Stuff" 
                item-ancestor="" 
                item-active=""
                item-has-children=""
                item-children-async=""
            >
                <div class="c-navbar__item">
                    <span>Stuff</span>
                </div>
            </a>
                    <a 
                href="#" 
                aria-label="More" 
                item-ancestor="" 
                item-active=""
                item-has-children=""
                item-children-async=""
            >
                <div class="c-navbar__item">
                    <span>More</span>
                </div>
            </a>
            </div>

            <div class="c-navbar__item c-navbar__expand">
                <button class="c-button c-button__basic c-button__basic--default c-button--md" target="_top" js-toggle-trigger="navbar-content" type="button" aria-label="Meny" data-uid="673ed2838d42a">   
     <span class="c-button__label">         
                    <span class="c-button__label-icon ">
                    <!-- icon.blade.php -->
    <span class="c-icon c-icon--expand-more c-icon--material c-icon--material-expand_more material-symbols material-symbols-rounded material-symbols-sharp material-symbols-outlined  c-icon--size-md" aria-hidden="false" material-symbol="expand_more" role="img" data-nosnippet="" translate="no" aria-label="Icon: Undefined" alt="Icon: Undefined" data-uid="673ed2838d465">
                    </span>
            </span>
        
                    <span class="c-button__label-text ">
                Meny
            </span>
        
    </span> </button>        </div>
    
            <div class="c-navbar__content" js-toggle-item="navbar-content" js-toggle-class="u-height--auto">
                        <div class="c-navbar__expanded_main">
                <a class="c-button c-navbar__prev c-button__basic c-button__basic--default c-button--lg" target="_top" type="button" href="#" aria-label="Hem" data-uid="673ed2838d4e3">   
     <span class="c-button__label">         
                    <span class="c-button__label-icon c-button__label-icon--reverse">
                    <!-- icon.blade.php -->
    <span class="c-icon c-icon--arrow-back c-icon--material c-icon--material-arrow_back material-symbols material-symbols-rounded material-symbols-sharp material-symbols-outlined  c-icon--size-lg" aria-hidden="false" material-symbol="arrow_back" role="img" data-nosnippet="" translate="no" aria-label="Icon: Undefined" alt="Icon: Undefined" data-uid="673ed2838d521">
                    </span>
            </span>
        
                    <span class="c-button__label-text c-button__label-text--reverse">
                Hem
            </span>
        
    </span> </a>        
        <!-- typography.blade.php   original: h2 -->
<h2 class="c-typography u-margin__top--8 c-typography__variant--h2" data-uid="673ed2838d579">
    Bidrag och Underhåll
</h2>
    </div>        </div>
    </nav>
@navbar([
    'logo' => '/assets/img/logotype.svg',
    'items' => [
        "about" => [
            "label" => "About",
            "href" => "#",
            "icon" => "people"
        ],
        "stuff" => [
            "label" => "Stuff",
            "href" => "#",
            "icon" => "people"
        ],
        "more" => [
            "label" => "More",
            "href" => "#",
            "icon" => "people"
        ]
    ],
    'expanded_prev' => 'Hem',
    'expanded_current' => 'Bidrag och Underhåll',
    'expanded_menu' => [
        "about" => [
            "label" => "About",
            "href" => "#",
            "icon" => "people"
        ],
        "stuff" => [
            "label" => "Stuff",
            "href" => "#",
            "icon" => "people"
        ],
        "more" => [
            "label" => "More",
            "href" => "#",
            "icon" => "people"
        ]
    ],
    'classList' => ['u-position--relative', 'c-navbar--border-top']
])
@endnavbar

Navbar border bottom

Navigation with a bar and border on the bottom

<!-- navbar.blade.php -->
<nav class="c-navbar u-position--relative c-navbar--border-bottom" data-uid="673ed2838d8c7">
    <div class="c-navbar__toggle">
            <!-- icon.blade.php -->
    <span class="c-icon c-icon--menu c-icon--material c-icon--material-menu material-symbols material-symbols-rounded material-symbols-sharp material-symbols-outlined  c-icon--size-xl" js-sidebar-trigger="" material-symbol="menu" role="img" data-nosnippet="" translate="no" aria-label="Icon: Undefined" alt="Icon: Undefined" aria-hidden="false" data-uid="673ed2838d950">
                    </span>
    </div>

    
    <div class="c-navbar__logo">
        <a href="/">
                <!-- image.blade.php -->
<figure class="c-image c-image--type-svg" data-uid="673ed2838d9c8">
     
        <img src="/assets/img/logotype.svg" alt="A logo" class="c-image__image" />
            </figure>

        </a>
    </div>
    
    <div class="c-navbar__list">
                    
                
                    <a 
                href="#" 
                aria-label="About" 
                item-ancestor="" 
                item-active=""
                item-has-children=""
                item-children-async=""
            >
                <div class="c-navbar__item">
                    <span>About</span>
                </div>
            </a>
                    <a 
                href="#" 
                aria-label="Stuff" 
                item-ancestor="" 
                item-active=""
                item-has-children=""
                item-children-async=""
            >
                <div class="c-navbar__item">
                    <span>Stuff</span>
                </div>
            </a>
                    <a 
                href="#" 
                aria-label="More" 
                item-ancestor="" 
                item-active=""
                item-has-children=""
                item-children-async=""
            >
                <div class="c-navbar__item">
                    <span>More</span>
                </div>
            </a>
            </div>

            <div class="c-navbar__item c-navbar__expand">
                <button class="c-button c-button__basic c-button__basic--default c-button--md" target="_top" js-toggle-trigger="navbar-content" type="button" aria-label="Meny" data-uid="673ed2838da0d">   
     <span class="c-button__label">         
                    <span class="c-button__label-icon ">
                    <!-- icon.blade.php -->
    <span class="c-icon c-icon--expand-more c-icon--material c-icon--material-expand_more material-symbols material-symbols-rounded material-symbols-sharp material-symbols-outlined  c-icon--size-md" aria-hidden="false" material-symbol="expand_more" role="img" data-nosnippet="" translate="no" aria-label="Icon: Undefined" alt="Icon: Undefined" data-uid="673ed2838da44">
                    </span>
            </span>
        
                    <span class="c-button__label-text ">
                Meny
            </span>
        
    </span> </button>        </div>
    
            <div class="c-navbar__content" js-toggle-item="navbar-content" js-toggle-class="u-height--auto">
                        <div class="c-navbar__expanded_main">
                <a class="c-button c-navbar__prev c-button__basic c-button__basic--default c-button--lg" target="_top" type="button" href="#" aria-label="Hem" data-uid="673ed2838da9f">   
     <span class="c-button__label">         
                    <span class="c-button__label-icon c-button__label-icon--reverse">
                    <!-- icon.blade.php -->
    <span class="c-icon c-icon--arrow-back c-icon--material c-icon--material-arrow_back material-symbols material-symbols-rounded material-symbols-sharp material-symbols-outlined  c-icon--size-lg" aria-hidden="false" material-symbol="arrow_back" role="img" data-nosnippet="" translate="no" aria-label="Icon: Undefined" alt="Icon: Undefined" data-uid="673ed2838dace">
                    </span>
            </span>
        
                    <span class="c-button__label-text c-button__label-text--reverse">
                Hem
            </span>
        
    </span> </a>        
        <!-- typography.blade.php   original: h2 -->
<h2 class="c-typography u-margin__top--8 c-typography__variant--h2" data-uid="673ed2838db05">
    Bidrag och Underhåll
</h2>
    </div>        </div>
    </nav>
@navbar([
    'logo' => '/assets/img/logotype.svg',
    'items' => [
        "about" => [
            "label" => "About",
            "href" => "#",
            "icon" => "people"
        ],
        "stuff" => [
            "label" => "Stuff",
            "href" => "#",
            "icon" => "people"
        ],
        "more" => [
            "label" => "More",
            "href" => "#",
            "icon" => "people"
        ]
    ],
    'expanded_prev' => 'Hem',
    'expanded_current' => 'Bidrag och Underhåll',
    'expanded_menu' => [
        "about" => [
            "label" => "About",
            "href" => "#",
            "icon" => "people"
        ],
        "stuff" => [
            "label" => "Stuff",
            "href" => "#",
            "icon" => "people"
        ],
        "more" => [
            "label" => "More",
            "href" => "#",
            "icon" => "people"
        ]
    ],
    'classList' => ['u-position--relative', 'c-navbar--border-bottom']
])
@endnavbar

Blade component parameters

Key Default value Type Available values Description
logo string - A link to a logo
items [] array - An array of links
sidebar false boolean - If set to true the toggle will toggle sidebar
expanded_menu false boolean - Data for expanded menu
isDynamic false boolean - -
id string - The DOM id of the component.
classList [] array - Array containing wrapping classes array
attributeList [] array - Array containing keys and values rendered as attributes
containerAware false boolean true/false Makes the component container aware. Appends modifiers --size--xs/sm/md/lg to the component.
Settings location: /var/www/webroot/ROOT/vendor/helsingborg-stad/component-library/source/php/Component/Navbar/navbar.json