123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119 |
- ---
- title: Navbar
- layout: documentation
- doc-tab: components
- doc-subtab: navbar
- breadcrumb:
- - home
- - documentation
- - components
- - components-navbar
- meta:
- colors: true
- sizes: false
- variables: true
- ---
- {% capture navbar_example %}
- {% include examples/navbar.html id="Default" %}
- {% endcapture %}
- {% capture navbar_brand_example %}
- <nav class="navbar" role="navigation" aria-label="main navigation">
- <div class="navbar-brand">
- <!-- navbar items, navbar burger... -->
- </div>
- </nav>
- {% endcapture %}
- {% capture navbar_burger_example %}
- <a role="button" class="navbar-burger" aria-label="menu" aria-expanded="false">
- <span aria-hidden="true"></span>
- <span aria-hidden="true"></span>
- <span aria-hidden="true"></span>
- </a>
- {% endcapture %}
- {% capture navbar_brand_items_example %}
- <nav class="navbar" role="navigation" aria-label="main navigation">
- <div class="navbar-brand">
- <a class="navbar-item" href="{{ site.url }}">
- <img src="{{ site.url }}/images/bulma-logo.png" alt="{{ site.data.meta.title }}" width="112" height="28">
- </a>
- <a role="button" class="navbar-burger" aria-label="menu" aria-expanded="false">
- <span aria-hidden="true"></span>
- <span aria-hidden="true"></span>
- <span aria-hidden="true"></span>
- </a>
- </div>
- </nav>
- {% endcapture %}
- {% capture navbar_menu_example %}
- <nav class="navbar" role="navigation" aria-label="main navigation">
- <div class="navbar-brand">
- <!-- navbar items, navbar burger... -->
- </div>
- <div class="navbar-menu">
- <!-- navbar start, navbar end -->
- </div>
- </nav>
- {% endcapture %}
- {% capture navbar_menu_active_example %}
- <div class="navbar-menu">
- <!-- hidden on mobile -->
- </div>
- <div class="navbar-menu is-active">
- <!-- shown on mobile -->
- </div>
- {% endcapture %}
- {% capture navbar_start_end_example %}
- <div class="navbar-menu">
- <div class="navbar-start">
- <!-- navbar items -->
- </div>
- <div class="navbar-end">
- <!-- navbar items -->
- </div>
- </div>
- {% endcapture %}
- {% capture navbar_item_link_example %}
- <a class="navbar-item">
- Home
- </a>
- {% endcapture %}
- {% capture navbar_item_brand_example %}
- <a class="navbar-item">
- <img src="{{ site.url }}/images/bulma-logo.png" width="112" height="28" alt="Bulma">
- </a>
- {% endcapture %}
- {% capture navbar_item_dropdown_example %}
- <div class="navbar-item has-dropdown">
- <a class="navbar-link">
- Docs
- </a>
- <div class="navbar-dropdown">
- <!-- Other navbar items -->
- </div>
- </div>
- {% endcapture %}
- {% capture navbar_item_dropdown_bis_example %}
- <div class="navbar-dropdown">
- <a class="navbar-item">
- Overview
- </a>
- </div>
- {% endcapture %}
- {% capture navbar_item_other_example %}
- <div class="navbar-item">
- <div class="field is-grouped">
- <p class="control">
- <a class="button">
- <span class="icon">
- <i class="fas fa-twitter" aria-hidden="true"></i>
- </span>
- <span>Tweet</span>
- </a>
- </p>
- <p class="control">
- <a class="button is-primary">
- <span class="icon">
- <i class="fas fa-download" aria-hidden="true"></i>
- </span>
- <span>Download</span>
- </a>
- </p>
- </div>
- </div>
- {% endcapture %}
- {% capture navbar_transparent_example %}
- {% include examples/navbar.html transparent=true boxed=true id="TransparentExample" %}
- {% endcapture %}
- {% capture navbar_dropdown_example %}
- <nav class="navbar" role="navigation" aria-label="dropdown navigation">
- <div class="navbar-item has-dropdown">
- <a class="navbar-link">
- Docs
- </a>
- <div class="navbar-dropdown">
- <a class="navbar-item">
- Overview
- </a>
- <a class="navbar-item">
- Elements
- </a>
- <a class="navbar-item">
- Components
- </a>
- <hr class="navbar-divider">
- <div class="navbar-item">
- Version {{ site.data.meta.version }}
- </div>
- </div>
- </div>
- </nav>
- {% endcapture %}
- {% capture navbar_dropdown_hover_snippet %}
- <div class="navbar-item has-dropdown is-hoverable">
- <!-- navbar-link, navbar-dropdown etc. -->
- </div>
- {% endcapture %}
- {% capture navbar_dropdown_hover_example %}
- <nav class="navbar" role="navigation" aria-label="dropdown navigation">
- <div class="navbar-item has-dropdown is-hoverable">
- <a class="navbar-link">
- Docs
- </a>
- <div class="navbar-dropdown">
- <a class="navbar-item">
- Overview
- </a>
- <a class="navbar-item">
- Elements
- </a>
- <a class="navbar-item">
- Components
- </a>
- <hr class="navbar-divider">
- <div class="navbar-item">
- Version {{ site.data.meta.version }}
- </div>
- </div>
- </div>
- </nav>
- {% endcapture %}
- {% capture navbar_dropdown_active_snippet %}
- <div class="navbar-item has-dropdown is-active">
- <!-- navbar-link, navbar-dropdown etc. -->
- </div>
- {% endcapture %}
- {% capture navbar_dropdown_active_example %}
- <nav class="navbar" role="navigation" aria-label="dropdown navigation">
- <div class="navbar-item has-dropdown is-active">
- <a class="navbar-link">
- Docs
- </a>
- <div class="navbar-dropdown">
- <a class="navbar-item">
- Overview
- </a>
- <a class="navbar-item">
- Elements
- </a>
- <a class="navbar-item">
- Components
- </a>
- <hr class="navbar-divider">
- <div class="navbar-item">
- Version {{ site.data.meta.version }}
- </div>
- </div>
- </div>
- </nav>
- {% endcapture %}
- {% capture navbar_dropdown_right_snippet %}
- <div class="navbar-dropdown is-right">
- <!-- navbar-item, navbar-divider etc. -->
- </div>
- {% endcapture %}
- {% capture navbar_dropdown_right_example %}
- <nav class="navbar" role="navigation" aria-label="dropdown navigation">
- <div class="navbar-menu">
- <div class="navbar-start">
- <div class="navbar-item has-dropdown is-active">
- <a class="navbar-link">
- Left
- </a>
- <div class="navbar-dropdown">
- <a class="navbar-item">
- Overview
- </a>
- <a class="navbar-item">
- Elements
- </a>
- <a class="navbar-item">
- Components
- </a>
- <hr class="navbar-divider">
- <div class="navbar-item">
- Version {{ site.data.meta.version }}
- </div>
- </div>
- </div>
- </div>
- <div class="navbar-end">
- <div class="navbar-item has-dropdown is-active">
- <a class="navbar-link">
- Right
- </a>
- <div class="navbar-dropdown is-right">
- <a class="navbar-item">
- Overview
- </a>
- <a class="navbar-item">
- Elements
- </a>
- <a class="navbar-item">
- Components
- </a>
- <hr class="navbar-divider">
- <div class="navbar-item">
- Version {{ site.data.meta.version }}
- </div>
- </div>
- </div>
- </div>
- </div>
- </nav>
- <section class="hero is-primary">
- <div class="hero-body">
- <p class="title">
- Documentation
- </p>
- <p class="subtitle">
- Everything you need to <strong>create a website</strong> with Bulma
- </p>
- </div>
- </section>
- {% endcapture %}
- {% capture navbar_dropup_snippet %}
- <div class="navbar-item has-dropdown has-dropdown-up is-hoverable">
- <a class="navbar-link" href="/documentation/overview/start/">
- Docs
- </a>
- <div class="navbar-dropdown">
- <a class="navbar-item" href="/documentation/overview/start/">
- Overview
- </a>
- </div>
- </div>
- {% endcapture %}
- {% capture navbar_dropup_example %}
- <section class="hero is-primary">
- <div class="hero-body">
- <p class="title">
- Documentation
- </p>
- <p class="subtitle">
- Everything you need to <strong>create a website</strong> with Bulma
- </p>
- </div>
- </section>
- <nav class="navbar" role="navigation" aria-label="dropdown navigation">
- <div class="navbar-menu">
- <div class="navbar-start">
- <div class="navbar-item has-dropdown has-dropdown-up is-active">
- <a class="navbar-link">
- Dropup
- </a>
- <div class="navbar-dropdown">
- <a class="navbar-item">
- Overview
- </a>
- <a class="navbar-item">
- Elements
- </a>
- <a class="navbar-item">
- Components
- </a>
- <hr class="navbar-divider">
- <div class="navbar-item">
- Version {{ site.data.meta.version }}
- </div>
- </div>
- </div>
- </div>
- </div>
- </nav>
- {% endcapture %}
- {% capture navbar_dropdown_default_example %}
- <nav class="navbar" role="navigation" aria-label="dropdown navigation">
- <a class="navbar-item">
- <img src="{{ site.url }}/images/bulma-logo.png" alt="{{ site.data.meta.title }}" width="112" height="28">
- </a>
- <div class="navbar-item has-dropdown is-active">
- <a class="navbar-link">
- Docs
- </a>
- <div class="navbar-dropdown">
- <a class="navbar-item">
- Overview
- </a>
- <a class="navbar-item">
- Elements
- </a>
- <a class="navbar-item">
- Components
- </a>
- <hr class="navbar-divider">
- <div class="navbar-item">
- Version {{ site.data.meta.version }}
- </div>
- </div>
- </div>
- </nav>
- <section class="hero is-primary">
- <div class="hero-body">
- <p class="title">
- Documentation
- </p>
- <p class="subtitle">
- Everything you need to <strong>create a website</strong> with Bulma
- </p>
- </div>
- </section>
- {% endcapture %}
- {% capture navbar_dropdown_boxed_example %}
- <nav class="navbar is-transparent" role="navigation" aria-label="dropdown navigation">
- <a class="navbar-item">
- <img src="{{ site.url }}/images/bulma-logo.png" alt="{{ site.data.meta.title }}" width="112" height="28">
- </a>
- <div class="navbar-item has-dropdown is-active">
- <a class="navbar-link">
- Docs
- </a>
- <div class="navbar-dropdown is-boxed">
- <a class="navbar-item">
- Overview
- </a>
- <a class="navbar-item">
- Elements
- </a>
- <a class="navbar-item">
- Components
- </a>
- <hr class="navbar-divider">
- <div class="navbar-item">
- Version {{ site.data.meta.version }}
- </div>
- </div>
- </div>
- </nav>
- <section class="hero">
- <div class="hero-body">
- <p class="title">
- Documentation
- </p>
- <p class="subtitle">
- Everything you need to <strong>create a website</strong> with Bulma
- </p>
- </div>
- </section>
- {% endcapture %}
- {% capture navbar_dropdown_item_active_example %}
- <nav class="navbar" role="navigation" aria-label="dropdown navigation">
- <a class="navbar-item">
- <img src="{{ site.url }}/images/bulma-logo.png" alt="{{ site.data.meta.title }}" width="112" height="28">
- </a>
- <div class="navbar-item has-dropdown is-active">
- <a class="navbar-link">
- Docs
- </a>
- <div class="navbar-dropdown">
- <a class="navbar-item">
- Overview
- </a>
- <a class="navbar-item is-active">
- Elements
- </a>
- <a class="navbar-item">
- Components
- </a>
- <hr class="navbar-divider">
- <div class="navbar-item">
- Version {{ site.data.meta.version }}
- </div>
- </div>
- </div>
- </nav>
- <section class="hero is-primary">
- <div class="hero-body">
- <p class="title">
- Documentation
- </p>
- <p class="subtitle">
- Everything you need to <strong>create a website</strong> with Bulma
- </p>
- </div>
- </section>
- {% endcapture %}
- {% capture navbar_divider_example %}
- <hr class="navbar-divider">
- {% endcapture %}
- {% capture navbar_js_html %}
- <a role="button" class="navbar-burger" data-target="navMenu" aria-label="menu" aria-expanded="false">
- <span aria-hidden="true"></span>
- <span aria-hidden="true"></span>
- <span aria-hidden="true"></span>
- </a>
- <div class="navbar-menu" id="navMenu">
- <!-- navbar-start, navbar-end... -->
- </div>
- {% endcapture %}
- {% capture navbar_js_code %}
- document.addEventListener('DOMContentLoaded', function () {
- // Get all "navbar-burger" elements
- var $navbarBurgers = Array.prototype.slice.call(document.querySelectorAll('.navbar-burger'), 0);
- // Check if there are any navbar burgers
- if ($navbarBurgers.length > 0) {
- // Add a click event on each of them
- $navbarBurgers.forEach(function ($el) {
- $el.addEventListener('click', function () {
- // Get the target from the "data-target" attribute
- var target = $el.dataset.target;
- var $target = document.getElementById(target);
- // Toggle the class on both the "navbar-burger" and the "navbar-menu"
- $el.classList.toggle('is-active');
- $target.classList.toggle('is-active');
- });
- });
- }
- });
- {% endcapture %}
- {% capture navbar_color_markup %}
- <nav class="navbar is-primary">
- <!-- navbar brand, navbar menu... -->
- </nav>
- {% endcapture %}
- <div class="message is-success">
- <div class="message-body">
- <p>The new <code>navbar</code> replaces the deprecated <code>nav</code> component, whose documentation you can still access temporarily <a href="{{ site.url }}/documentation/components/nav/">here</a>.</p>
- </div>
- </div>
- <div class="content">
- <p>
- The <code>navbar</code> component is a responsive and versatile horizontal navigation bar with the following structure:
- </p>
- <ul>
- <li>
- <code>navbar</code> the <strong>main</strong> container
- <ul>
- <li>
- <code>navbar-brand</code> the <strong>left side</strong>, <strong class="has-text-success">always visible</strong>, which usually contains the <strong>logo</strong> and optionally some links or icons
- <ul>
- <li>
- <code>navbar-burger</code> the <strong>hamburger</strong> icon, which toggles the navbar menu on touch devices
- </li>
- </ul>
- </li>
- <li>
- <code>navbar-menu</code> the <strong>right side</strong>, hidden on touch devices, visible on desktop
- <ul>
- <li>
- <code>navbar-start</code> the <strong>left part</strong> of the menu, which appears next to the navbar brand on desktop
- </li>
- <li>
- <code>navbar-end</code> the <strong>right part</strong> of the menu, which appears at the end of the navbar
- <ul>
- <li>
- <code>navbar-item</code> each <strong>single item</strong> of the navbar, which can either be an <code>a</code> or a <code>div</code>
- <ul>
- <li>
- <code>navbar-link</code> a <strong>link</strong> as the sibling of a dropdown, with an arrow
- </li>
- <li>
- <code>navbar-dropdown</code> the <strong>dropdown menu</strong>, which can include navbar items and dividers
- <ul>
- <li>
- <code>navbar-divider</code> a <strong>horizontal line</strong> to separate navbar items
- </li>
- </ul>
- </li>
- </ul>
- </li>
- </ul>
- </li>
- </ul>
- </li>
- </ul>
- </li>
- </ul>
- </div>
- {% include elements/anchor.html name="Navbar brand" %}
- <div class="content">
- <p>
- The <code>navbar-brand</code> is the left side of the navbar. It can contain:
- </p>
- <ul>
- <li>
- a number of <code>navbar-item</code>
- </li>
- <li>
- the <code>navbar-burger</code> as last child
- </li>
- </ul>
- </div>
- {% highlight html %}{{navbar_brand_example}}{% endhighlight %}
- <div class="content">
- <p>
- The navbar brand is <strong>always visible</strong>: on both touch devices {% include bp/touch.html %} and desktop {% include bp/desktop.html %}. As a result, it is recommended to only use a few navbar items to avoid <strong>overflowing</strong> horizontally on small devices.
- </p>
- </div>
- <div class="bd-example is-paddingless">
- {{navbar_brand_items_example}}
- </div>
- {% highlight html %}{{navbar_brand_items_example}}{% endhighlight %}
- <div class="content">
- <p>
- On desktop {% include bp/desktop.html %}, the navbar brand will only take up the space it needs.
- </p>
- </div>
- {% include elements/anchor.html name="Navbar burger" %}
- <div class="content">
- <p>
- The <code>navbar-burger</code> is a hamburger menu that only appears on <strong>mobile</strong>. It has to appear as the last child of <code>navbar-brand</code>.
- </p>
- </div>
- <div class="example is-paddingless">
- <a role="button" class="navbar-burger" aria-label="menu" aria-expanded="false" style="display: flex;">
- <span aria-hidden="true"></span>
- <span aria-hidden="true"></span>
- <span aria-hidden="true"></span>
- </a>
- </div>
- {% highlight html %}{{ navbar_burger_example }}{% endhighlight %}
- <div class="content">
- <p>
- You can add the modifier class <code>is-active</code> to turn it into a cross.
- </p>
- </div>
- <div class="example is-paddingless">
- <a role="button" class="navbar-burger is-active" aria-label="menu" aria-expanded="false" style="display: flex;">
- <span aria-hidden="true"></span>
- <span aria-hidden="true"></span>
- <span aria-hidden="true"></span>
- </a>
- </div>
- {% include elements/anchor.html name="Navbar menu" %}
- <div class="content">
- <p>
- The <code>navbar-menu</code> is the <strong>counterpart</strong> of the navbar brand. As such, it must appear as a direct child of <code>navbar</code>, as a sibling of <code>navbar-brand</code>.
- </p>
- </div>
- {% highlight html %}{{navbar_menu_example}}{% endhighlight %}
- <div class="content">
- <p>
- The <code>navbar-menu</code> is <strong>hidden on touch devices</strong> {% include bp/touch.html %}. You need to add the modifier class <code>is-active</code> to display it.
- </p>
- </div>
- {% highlight html %}{{navbar_menu_active_example}}{% endhighlight %}
- <div class="content">
- <p>
- On desktop {% include bp/desktop.html %}, the <code>navbar-menu</code> will <strong>fill up the space</strong> available in the navbar, leaving the navbar brand just the space it needs. It needs, however, two elements as direct children:
- </p>
- <ul>
- <li>
- <code>navbar-start</code>
- </li>
- <li>
- <code>navbar-end</code>
- </li>
- </ul>
- </div>
- <hr>
- <div id="navbarJsExample" class="message is-info">
- <h4 class="message-header">Javascript toggle</h4>
- <div class="message-body">
- <div class="content">
- <p>
- The Bulma package <strong>does not come with any JavaScript</strong>.
- <br>
- Here is however an implementation example, which toggles the class <code>is-active</code> on both the <code>navbar-burger</code> and the targeted <code>navbar-menu</code>.
- </p>
- {% highlight html %}{{ navbar_js_html }}{% endhighlight %}
- {% highlight javascript %}{{ navbar_js_code }}{% endhighlight %}
- </div>
- </div>
- </div>
- {% include elements/anchor.html name="Navbar start and navbar end" %}
- <div class="content">
- <p>
- The <code>navbar-start</code> and <code>navbar-end</code> are the two direct and only children of the <code>navbar-menu</code>.
- </p>
- <p>
- On desktop {% include bp/desktop.html %}:
- </p>
- <ul>
- <li>
- <code>navbar-start</code> will appear on the <strong>left</strong>
- </li>
- <li>
- <code>navbar-end</code> will appear on the <strong>right</strong>
- </li>
- </ul>
- <p>
- Each of them can contain any number of <code>navbar-item</code>.
- </p>
- </div>
- {% highlight html %}{{navbar_start_end_example}}{% endhighlight %}
- {% include elements/anchor.html name="Navbar item" %}
- <div class="content">
- <p>
- A <code>navbar-item</code> is a repeatable element that can be:
- </p>
- <ul class="bd-spaced">
- <li>
- a navigation <strong>link</strong>
- {% highlight html %}{{ navbar_item_link_example }}{% endhighlight %}
- </li>
- <li>
- a container for the <strong>brand logo</strong>
- {% highlight html %}{{ navbar_item_brand_example }}{% endhighlight %}
- </li>
- <li>
- the <strong>parent</strong> of a dropdown menu
- {% highlight html %}{{ navbar_item_dropdown_example }}{% endhighlight %}
- </li>
- <li>
- a child of a <strong>navbar dropdown</strong>
- {% highlight html %}{{ navbar_item_dropdown_bis_example }}{% endhighlight %}
- </li>
- <li>
- a container for almost <strong>anything</strong> you want, like a <code>field</code>
- <div class="highlight-full">
- {% highlight html %}{{ navbar_item_other_example }}{% endhighlight %}
- </div>
- </li>
- </ul>
- <p>
- It can either be an anchor tag <code><a></code> or a <code><div></code>, as a <strong>direct child</strong> of either:
- </p>
- <ul>
- <li>
- <code>navbar</code>
- </li>
- <li>
- <code>navbar-brand</code>
- </li>
- <li>
- <code>navbar-start</code>
- </li>
- <li>
- <code>navbar-end</code>
- </li>
- <li>
- <code>navbar-dropdown</code>
- </li>
- </ul>
- <p>
- You can add the modifier class <code>is-expanded</code> to turn it into a full-width element.
- </p>
- </div>
- {% include elements/anchor.html name="Transparent navbar" %}
- <div class="content">
- <p>
- To seamlessly integrate the navbar in any visual context, you can add the <code>is-transparent</code> modifier on the <code>navbar</code> component. This will remove any hover or active background from the navbar items.
- </p>
- </div>
- {% include elements/snippet.html content=navbar_transparent_example paddingless=true horizontal=true more=true %}
- {% include elements/anchor.html name="Fixed navbar" %}
- {% include elements/new-tag.html version="0.6.1" %}
- <div class="content">
- <p>
- You can now <strong>fix</strong> the navbar to either the <strong>top</strong> or <strong>bottom</strong> of the page. This is a 2-step process:
- </p>
- <ul class="bd-spaced">
- <li>
- Add either <code>is-fixed-top</code> or <code>is-fixed-bottom</code> to the <code>navbar</code> component
- {% highlight html %}<nav class="navbar is-fixed-top">{% endhighlight %}
- </li>
- <li>
- Add the corresponding <code>has-navbar-fixed-top</code> or <code>has-navbar-fixed-bottom</code> modifier to either <code><html></code> or <code><body></code> element to provide the appropriate padding to the page
- {% highlight html %}<html class="has-navbar-fixed-top">{% endhighlight %}
- </li>
- </ul>
- </div>
- <h4 class="title is-5">Try it out!</h4>
- <div id="navbarToggles" class="buttons">
- <a id="navbarFixBottom" class="button is-link">
- <span><span id="navbarFixBottomText">Show</span> <strong>bottom</strong> navbar</span>
- </a>
- </div>
- {% include elements/anchor.html name="Dropdown menu" %}
- <div class="content">
- <p>
- To create a <strong>dropdown menu</strong>, you will need <strong>4</strong> elements:
- </p>
- <ul>
- <li>
- <code>navbar-item</code> with the <code>has-dropdown</code> modifier
- </li>
- <li>
- <code>navbar-link</code> which contains the dropdown arrow
- </li>
- <li>
- <code>navbar-dropdown</code> which can contain instances of <code>navbar-item</code> and <code>navbar-divider</code>
- </li>
- </ul>
- </div>
- <div class="columns">
- <div class="column">
- <div class="bd-example is-paddingless">
- {{ navbar_dropdown_example }}
- </div>
- </div>
- <div class="column">
- {% highlight html %}{{ navbar_dropdown_example }}{% endhighlight %}
- </div>
- </div>
- <h4 class="title is-4">
- Show/hide the dropdown with either <strong>CSS</strong> or <strong>JavaScript</strong>
- </h4>
- <div class="content">
- <p>
- The <code>navbar-dropdown</code> is visible on touch devices {% include bp/touch.html %} but hidden on desktop {% include bp/desktop.html %}. <em>How</em> the dropdown is displayed on desktop depends on the parent's class.
- </p>
- <p>
- The <code>navbar-item</code> with the <code>has-dropdown</code> modifier, has <strong>2 additional modifiers</strong>
- </p>
- <ul>
- <li>
- <code>is-hoverable</code>: the dropdown will show up when <strong>hovering</strong> the parent <code>navbar-item</code>
- </li>
- <li>
- <code>is-active</code>: the dropdown will show up <strong>all the time</strong>
- </li>
- </ul>
- </div>
- <div class="message is-success">
- <p class="message-body">
- While the CSS <code>:hover</code> implementation works perfectly, the <code>is-active</code> class is available for users who want to control the display of the dropdown with <strong>JavaScript</strong>.
- </p>
- </div>
- {% highlight html %}{{ navbar_dropdown_hover_snippet }}{% endhighlight %}
- <div class="columns">
- <div class="column">
- <div class="bd-example is-paddingless">
- {{ navbar_dropdown_hover_example }}
- </div>
- </div>
- <div class="column">
- {% highlight html %}{{ navbar_dropdown_hover_example }}{% endhighlight %}
- </div>
- </div>
- {% highlight html %}{{ navbar_dropdown_active_snippet }}{% endhighlight %}
- <div class="columns">
- <div class="column">
- <div class="bd-example is-paddingless">
- {{ navbar_dropdown_active_example }}
- </div>
- </div>
- <div class="column">
- {% highlight html %}{{ navbar_dropdown_active_example }}{% endhighlight %}
- </div>
- </div>
- <h4 class="title is-4">
- Right dropdown
- </h4>
- <div class="content">
- <p>
- If your parent <code>navbar-item</code> is on the right side, you can position the dropdown to start from the <strong>right</strong> with the <code>is-right</code> modifier.
- </p>
- </div>
- {% highlight html %}{{ navbar_dropdown_right_snippet }}{% endhighlight %}
- <div class="columns">
- <div class="column">
- <div class="bd-example is-paddingless">
- {{ navbar_dropdown_right_example }}
- </div>
- </div>
- <div class="column">
- {% highlight html %}{{ navbar_dropdown_right_example }}{% endhighlight %}
- </div>
- </div>
- <h4 class="title is-4">
- Dropup
- </h4>
- {% include elements/new-tag.html version="0.6.1" %}
- <div class="content">
- <p>
- If you're using a navbar at the bottom, like the <a href="#fixed-navbar">fixed bottom navbar</a>, you might want to use a <strong>dropup menu</strong>. Simply add the <code>has-dropdown</code> and <code>has-dropdown-up</code> modifiers to the parent <code>navbar-item</code>.
- </p>
- </div>
- {% highlight html %}{{ navbar_dropup_snippet }}{% endhighlight %}
- <div class="columns">
- <div class="column">
- <div class="bd-example is-paddingless">
- {{ navbar_dropup_example }}
- </div>
- </div>
- <div class="column">
- {% highlight html %}{{ navbar_dropup_example }}{% endhighlight %}
- </div>
- </div>
- <h4 class="title is-4">
- Styles for the dropdown menu
- </h4>
- <div class="content">
- <p>
- By default, the <code>navbar-dropdown</code> has:
- </p>
- <ul>
- <li>
- a grey <code>border-top</code>
- </li>
- <li>
- a <code>border-radius</code> at both bottom corners
- </li>
- </ul>
- </div>
- <div class="columns">
- <div class="column">
- <div class="bd-example is-paddingless">
- {{ navbar_dropdown_default_example }}
- </div>
- </div>
- <div class="column">
- {% highlight html %}{{ navbar_dropdown_default_example }}{% endhighlight %}
- </div>
- </div>
- <div class="content">
- <p>
- When having a <a href="#transparent-navbar">transparent navbar</a>, it is preferable to use the boxed version of the dropdown, by using the <code>is-boxed</code> modifier.
- </p>
- <ul>
- <li>
- the grey border is <strong>removed</strong>
- </li>
- <li>
- a slight <strong>inner shadow</strong> is added
- </li>
- <li>
- all corners are <strong>rounded</strong>
- </li>
- <li>
- the hover/active state is <strong>animated</strong>
- </li>
- </ul>
- </div>
- <div class="columns">
- <div class="column">
- <div class="bd-example is-paddingless">
- {{ navbar_dropdown_boxed_example }}
- </div>
- </div>
- <div class="column">
- {% highlight html %}{{ navbar_dropdown_boxed_example }}{% endhighlight %}
- </div>
- </div>
- <h4 class="title is-4">
- Active dropdown navbar item
- </h4>
- <div class="columns">
- <div class="column">
- <div class="bd-example is-paddingless">
- {{ navbar_dropdown_item_active_example }}
- </div>
- </div>
- <div class="column">
- {% highlight html %}{{ navbar_dropdown_item_active_example }}{% endhighlight %}
- </div>
- </div>
- <h4 class="title is-4">
- Dropdown divider
- </h4>
- <div class="content">
- <p>
- You can add a <code>navbar-divider</code> to display a <strong>horizontal rule</strong> in a <code>navbar-dropdown</code>.
- </p>
- </div>
- {% highlight html %}{{ navbar_divider_example }}{% endhighlight %}
- {% include elements/anchor.html name="Colors" %}
- <div class="tags has-addons">
- <span class="tag">New!</span>
- <span class="tag is-info">0.5.2</span>
- </div>
- <div class="content">
- <p>
- You can change the background color of the <code>navbar</code> by using one of the <strong>9 color modifiers:</strong>
- </p>
- <ul>
- <li><code>is-primary</code></li>
- <li><code>is-link</code></li>
- <li><code>is-info</code></li>
- <li><code>is-success</code></li>
- <li><code>is-warning</code></li>
- <li><code>is-danger</code></li>
- <li><code>is-black</code></li>
- <li><code>is-dark</code></li>
- <li><code>is-light</code></li>
- <li><code>is-white</code></li>
- </ul>
- </div>
- {% highlight html %}{{ navbar_color_markup }}{% endhighlight %}
- <div class="bd-example is-paddingless">
- {% include examples/navbar-color.html color="primary" %}
- </div>
- <div class="bd-example is-paddingless">
- {% include examples/navbar-color.html color="link" %}
- </div>
- <div class="bd-example is-paddingless">
- {% include examples/navbar-color.html color="info" %}
- </div>
- <div class="bd-example is-paddingless">
- {% include examples/navbar-color.html color="success" %}
- </div>
- <div class="bd-example is-paddingless">
- {% include examples/navbar-color.html color="warning" light=true %}
- </div>
- <div class="bd-example is-paddingless">
- {% include examples/navbar-color.html color="danger" %}
- </div>
- <div class="bd-example is-paddingless">
- {% include examples/navbar-color.html color="black" %}
- </div>
- <div class="bd-example is-paddingless">
- {% include examples/navbar-color.html color="dark" %}
- </div>
- <div class="bd-example is-paddingless">
- {% include examples/navbar-color.html color="light" light=true %}
- </div>
- <div class="bd-example is-paddingless">
- {% include examples/navbar-color.html color="white" light=true %}
- </div>
- {% include elements/variables.html type='component' %}
|