navbar.html 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913
  1. ---
  2. layout: documentation
  3. doc-tab: components
  4. doc-subtab: navbar
  5. variables:
  6. - name: $navbar-background-color
  7. value: $white
  8. - name: $navbar-height
  9. value: 3.25rem
  10. - name: $navbar-item-color
  11. value: $grey-dark
  12. - name: $navbar-item-hover-color
  13. value: $black
  14. - name: $navbar-item-hover-background-color
  15. value: $background
  16. - name: $navbar-item-active-color
  17. value: $black
  18. - name: $navbar-item-active-background-color
  19. value: transparent
  20. - name: $navbar-tab-hover-background-color
  21. value: transparent
  22. - name: $navbar-tab-hover-border-bottom-color
  23. value: $primary
  24. - name: $navbar-tab-active-color
  25. value: $primary
  26. - name: $navbar-tab-active-background-color
  27. value: transparent
  28. - name: $navbar-tab-active-border-bottom-color
  29. value: $primary
  30. - name: $navbar-tab-active-border-bottom-style
  31. value: solid
  32. - name: $navbar-tab-active-border-bottom-width
  33. value: 3px
  34. - name: $navbar-dropdown-background-color
  35. value: $white
  36. - name: $navbar-dropdown-border-top
  37. value: 1px solid $border
  38. - name: $navbar-dropdown-offset
  39. value: -4px
  40. - name: $navbar-dropdown-arrow
  41. value: $link
  42. - name: $navbar-dropdown-radius
  43. value: $radius-large
  44. - name: $navbar-dropdown-z
  45. value: 20
  46. - name: $navbar-dropdown-boxed-radius
  47. value: $radius-large
  48. - name: $navbar-dropdown-boxed-shadow
  49. value: 0 8px 8px rgba($black, 0.1), 0 0 0 1px rgba($black, 0.1)
  50. - name: $navbar-dropdown-item-hover-color
  51. value: $black
  52. - name: $navbar-dropdown-item-hover-background-color
  53. value: $background
  54. - name: $navbar-dropdown-item-active-color
  55. value: $primary
  56. - name: $navbar-dropdown-item-active-background-color
  57. value: $background
  58. - name: $navbar-divider-background-color
  59. value: $border
  60. ---
  61. {% include subnav-components.html %}
  62. {% capture navbar_example %}
  63. {% include navbar.html id="Example" %}
  64. {% endcapture %}
  65. {% capture navbar_brand_example %}
  66. <nav class="navbar">
  67. <div class="navbar-brand">
  68. <!-- navbar items, navbar burger ... -->
  69. </div>
  70. </nav>
  71. {% endcapture %}
  72. {% capture navbar_burger_example %}
  73. <div class="navbar-burger">
  74. <span></span>
  75. <span></span>
  76. <span></span>
  77. </div>
  78. {% endcapture %}
  79. {% capture navbar_brand_items_example %}
  80. <nav class="navbar">
  81. <div class="navbar-brand">
  82. <a class="navbar-item" href="{{ site.url }}">
  83. <img src="{{ site.url }}/images/bulma-logo.png" alt="{{ site.title }}" width="112" height="28">
  84. </a>
  85. <div class="navbar-burger">
  86. <span></span>
  87. <span></span>
  88. <span></span>
  89. </div>
  90. </div>
  91. </nav>
  92. {% endcapture %}
  93. {% capture navbar_menu_example %}
  94. <nav class="navbar">
  95. <div class="navbar-brand">
  96. <!-- navbar items, nav burger ... -->
  97. </div>
  98. <div class="navbar-menu">
  99. <!-- navbar start, navbar end -->
  100. </div>
  101. </nav>
  102. {% endcapture %}
  103. {% capture navbar_menu_active_example %}
  104. <div class="navbar-menu">
  105. <!-- hidden on mobile -->
  106. </div>
  107. <div class="navbar-menu is-active">
  108. <!-- shown on mobile -->
  109. </div>
  110. {% endcapture %}
  111. {% capture navbar_start_end_example %}
  112. <div class="navbar-menu">
  113. <div class="navbar-start">
  114. <!-- navbar items -->
  115. </div>
  116. <div class="navbar-end">
  117. <!-- navbar items -->
  118. </div>
  119. </div>
  120. {% endcapture %}
  121. {% capture navbar_item_link_example %}
  122. <a class="navbar-item">
  123. Home
  124. </a>
  125. {% endcapture %}
  126. {% capture navbar_item_brand_example %}
  127. <a class="navbar-item">
  128. <img src="{{ site.url }}/images/bulma-logo.png" width="112" height="28">
  129. </a>
  130. {% endcapture %}
  131. {% capture navbar_item_dropdown_example %}
  132. <div class="navbar-item has-dropdown">
  133. <a class="navbar-link">
  134. Docs
  135. </a>
  136. <div class="navbar-dropdown">
  137. <!-- Other navbar items -->
  138. </div>
  139. </div>
  140. {% endcapture %}
  141. {% capture navbar_item_dropdown_bis_example %}
  142. <div class="navbar-dropdown">
  143. <a class="navbar-item">
  144. Overview
  145. </a>
  146. </div>
  147. {% endcapture %}
  148. {% capture navbar_item_other_example %}
  149. <div class="navbar-item">
  150. <div class="field is-grouped">
  151. <p class="control">
  152. <a class="button">
  153. <span class="icon">
  154. <i class="fa fa-twitter"></i>
  155. </span>
  156. <span>Tweet</span>
  157. </a>
  158. </p>
  159. <p class="control">
  160. <a class="button is-primary">
  161. <span class="icon">
  162. <i class="fa fa-download"></i>
  163. </span>
  164. <span>Download</span>
  165. </a>
  166. </p>
  167. </div>
  168. </div>
  169. {% endcapture %}
  170. {% capture navbar_transparent_example %}
  171. {% include navbar.html transparent=true boxed=true id="TransparentExample" %}
  172. {% endcapture %}
  173. {% capture navbar_dropdown_example %}
  174. <nav class="navbar">
  175. <div class="navbar-item has-dropdown">
  176. <a class="navbar-link">
  177. Docs
  178. </a>
  179. <div class="navbar-dropdown">
  180. <a class="navbar-item">
  181. Overview
  182. </a>
  183. <a class="navbar-item">
  184. Elements
  185. </a>
  186. <a class="navbar-item">
  187. Components
  188. </a>
  189. <hr class="navbar-divider">
  190. <div class="navbar-item">
  191. Version {{ site.version }}
  192. </div>
  193. </div>
  194. </div>
  195. </nav>
  196. {% endcapture %}
  197. {% capture navbar_dropdown_hover_example %}
  198. <nav class="navbar">
  199. <div class="navbar-item has-dropdown is-hoverable">
  200. <a class="navbar-link">
  201. Docs
  202. </a>
  203. <div class="navbar-dropdown">
  204. <a class="navbar-item">
  205. Overview
  206. </a>
  207. <a class="navbar-item">
  208. Elements
  209. </a>
  210. <a class="navbar-item">
  211. Components
  212. </a>
  213. <hr class="navbar-divider">
  214. <div class="navbar-item">
  215. Version {{ site.version }}
  216. </div>
  217. </div>
  218. </div>
  219. </nav>
  220. {% endcapture %}
  221. {% capture navbar_dropdown_active_example %}
  222. <nav class="navbar">
  223. <div class="navbar-item has-dropdown is-active">
  224. <a class="navbar-link">
  225. Docs
  226. </a>
  227. <div class="navbar-dropdown">
  228. <a class="navbar-item">
  229. Overview
  230. </a>
  231. <a class="navbar-item">
  232. Elements
  233. </a>
  234. <a class="navbar-item">
  235. Components
  236. </a>
  237. <hr class="navbar-divider">
  238. <div class="navbar-item">
  239. Version {{ site.version }}
  240. </div>
  241. </div>
  242. </div>
  243. </nav>
  244. {% endcapture %}
  245. {% capture navbar_dropdown_default_example %}
  246. <nav class="navbar">
  247. <a class="navbar-item">
  248. <img src="{{ site.url }}/images/bulma-logo.png" alt="{{ site.title }}" width="112" height="28">
  249. </a>
  250. <div class="navbar-item has-dropdown is-active">
  251. <a class="navbar-link">
  252. Docs
  253. </a>
  254. <div class="navbar-dropdown">
  255. <a class="navbar-item">
  256. Overview
  257. </a>
  258. <a class="navbar-item">
  259. Elements
  260. </a>
  261. <a class="navbar-item">
  262. Components
  263. </a>
  264. <hr class="navbar-divider">
  265. <div class="navbar-item">
  266. Version {{ site.version }}
  267. </div>
  268. </div>
  269. </div>
  270. </nav>
  271. <section class="hero is-primary">
  272. <div class="hero-body">
  273. <p class="title">
  274. Documentation
  275. </p>
  276. <p class="subtitle">
  277. Everything you need to <strong>create a website</strong> with Bulma
  278. </p>
  279. </div>
  280. </section>
  281. {% endcapture %}
  282. {% capture navbar_dropdown_boxed_example %}
  283. <nav class="navbar is-transparent">
  284. <a class="navbar-item">
  285. <img src="{{ site.url }}/images/bulma-logo.png" alt="{{ site.title }}" width="112" height="28">
  286. </a>
  287. <div class="navbar-item has-dropdown is-active">
  288. <a class="navbar-link">
  289. Docs
  290. </a>
  291. <div class="navbar-dropdown is-boxed">
  292. <a class="navbar-item">
  293. Overview
  294. </a>
  295. <a class="navbar-item">
  296. Elements
  297. </a>
  298. <a class="navbar-item">
  299. Components
  300. </a>
  301. <hr class="navbar-divider">
  302. <div class="navbar-item">
  303. Version {{ site.version }}
  304. </div>
  305. </div>
  306. </div>
  307. </nav>
  308. <section class="hero">
  309. <div class="hero-body">
  310. <p class="title">
  311. Documentation
  312. </p>
  313. <p class="subtitle">
  314. Everything you need to <strong>create a website</strong> with Bulma
  315. </p>
  316. </div>
  317. </section>
  318. {% endcapture %}
  319. {% capture navbar_dropdown_item_active_example %}
  320. <nav class="navbar">
  321. <a class="navbar-item">
  322. <img src="{{ site.url }}/images/bulma-logo.png" alt="{{ site.title }}" width="112" height="28">
  323. </a>
  324. <div class="navbar-item has-dropdown is-active">
  325. <a class="navbar-link">
  326. Docs
  327. </a>
  328. <div class="navbar-dropdown">
  329. <a class="navbar-item">
  330. Overview
  331. </a>
  332. <a class="navbar-item is-active">
  333. Elements
  334. </a>
  335. <a class="navbar-item">
  336. Components
  337. </a>
  338. <hr class="navbar-divider">
  339. <div class="navbar-item">
  340. Version {{ site.version }}
  341. </div>
  342. </div>
  343. </div>
  344. </nav>
  345. <section class="hero is-primary">
  346. <div class="hero-body">
  347. <p class="title">
  348. Documentation
  349. </p>
  350. <p class="subtitle">
  351. Everything you need to <strong>create a website</strong> with Bulma
  352. </p>
  353. </div>
  354. </section>
  355. {% endcapture %}
  356. {% capture navbar_divider_example %}
  357. <hr class="navbar-divider">
  358. {% endcapture %}
  359. {% capture navbar_js_html %}
  360. <div class="navbar-burger" data-target="navMenu">
  361. <span></span>
  362. <span></span>
  363. <span></span>
  364. </div>
  365. <div class="navbar-menu" id="navMenu">
  366. <!-- navbar-start, navbar-end... -->
  367. </div>
  368. {% endcapture %}
  369. {% capture navbar_js_code %}
  370. document.addEventListener('DOMContentLoaded', function () {
  371. // Get all "navbar-burger" elements
  372. var $navbarBurgers = Array.prototype.slice.call(document.querySelectorAll('.navbar-burger'), 0);
  373. // Check if there are any nav burgers
  374. if ($navbarBurgers.length > 0) {
  375. // Add a click event on each of them
  376. $navbarBurgers.forEach(function ($el) {
  377. $el.addEventListener('click', () => {
  378. // Get the target from the "data-target" attribute
  379. var target = $el.dataset.target;
  380. var $target = document.getElementById(target);
  381. // Toggle the class on both the "navbar-burger" and the "navbar-menu"
  382. $el.classList.toggle('is-active');
  383. $target.classList.toggle('is-active');
  384. });
  385. });
  386. }
  387. });
  388. {% endcapture %}
  389. <section class="section">
  390. <div class="container">
  391. <h1 class="title">Navbar</h1>
  392. <h2 class="subtitle">
  393. A responsive horizontal <strong>navbar</strong> that can supports images, links, buttons, and dropdowns
  394. </h2>
  395. {%
  396. include meta.html
  397. new=true
  398. since="0.4.3"
  399. colors=false
  400. sizes=false
  401. variables=true
  402. %}
  403. <hr>
  404. <div class="message is-success">
  405. <div class="message-body">
  406. <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>
  407. </div>
  408. </div>
  409. <div class="content">
  410. <p>
  411. The <code>navbar</code> component is a responsive and versatile horizontal navigation bar with the following structure:
  412. </p>
  413. <ul>
  414. <li>
  415. <code>navbar</code> the <strong>main</strong> container
  416. <ul>
  417. <li>
  418. <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
  419. <ul>
  420. <li>
  421. <code>navbar-burger</code> the <strong>hamburger</strong> icon, which toggles the navbar menu on touch devices
  422. </li>
  423. </ul>
  424. </li>
  425. <li>
  426. <code>navbar-menu</code> the <strong>right side</strong>, hidden on touch devices, visible on desktop
  427. <ul>
  428. <li>
  429. <code>navbar-start</code> the <strong>left part</strong> of the menu, which appears next to the navbar brand on desktop
  430. </li>
  431. <li>
  432. <code>navbar-end</code> the <strong>right part</strong> of the menu, which appears at the end of the navbar
  433. <ul>
  434. <li>
  435. <code>navbar-item</code> each <strong>single item</strong> of the navbar, which can either be a <code>a</code> or a <code>div</code>
  436. <ul>
  437. <li>
  438. <code>navbar-link</code> a <strong>link</strong> as the sibling of a dropdown, with an arrow
  439. </li>
  440. <li>
  441. <code>navbar-dropdown</code> the <strong>dropdown menu</strong>, which can include navbar items and dividers
  442. <ul>
  443. <li>
  444. <code>navbar-divider</code> a <strong>horizontal line</strong> to separate navbar items
  445. </li>
  446. </ul>
  447. </li>
  448. </ul>
  449. </li>
  450. </ul>
  451. </li>
  452. </ul>
  453. </li>
  454. </ul>
  455. </li>
  456. </ul>
  457. </div>
  458. <div class="example is-paddingless">
  459. {{navbar_example}}
  460. </div>
  461. {% highlight html %}{{navbar_example}}{% endhighlight %}
  462. <hr>
  463. <h3 class="title">Navbar brand</h3>
  464. <div class="content">
  465. <p>
  466. The <code>navbar-brand</code> is the left side of the navbar. It can contain:
  467. </p>
  468. <ul>
  469. <li>
  470. a number of <code>navbar-item</code>
  471. </li>
  472. <li>
  473. the <code>navbar-burger</code> as last child
  474. </li>
  475. </ul>
  476. </div>
  477. {% highlight html %}{{navbar_brand_example}}{% endhighlight %}
  478. <div class="content">
  479. <p>
  480. 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.
  481. </p>
  482. </div>
  483. <div class="example is-paddingless">
  484. {{navbar_brand_items_example}}
  485. </div>
  486. {% highlight html %}{{navbar_brand_items_example}}{% endhighlight %}
  487. <div class="content">
  488. <p>
  489. On desktop {% include bp/desktop.html %}, the navbar brand will only take up the space it needs.
  490. </p>
  491. </div>
  492. <hr>
  493. <h3 class="title">Navbar burger</h3>
  494. <div class="content">
  495. <p>
  496. 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>.
  497. </p>
  498. </div>
  499. <div class="example is-paddingless">
  500. <div class="navbar-burger" style="display: flex;">
  501. <span></span>
  502. <span></span>
  503. <span></span>
  504. </div>
  505. </div>
  506. {% highlight html %}{{ navbar_burger_example }}{% endhighlight %}
  507. <div class="content">
  508. <p>
  509. You can add the modifier class <code>is-active</code> to turn it into a cross.
  510. </p>
  511. </div>
  512. <div class="example is-paddingless">
  513. <div class="navbar-burger is-active" style="display: flex;">
  514. <span></span>
  515. <span></span>
  516. <span></span>
  517. </div>
  518. </div>
  519. <hr>
  520. <h3 class="title">Navbar menu</h3>
  521. <div class="content">
  522. <p>
  523. 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>.
  524. </p>
  525. </div>
  526. {% highlight html %}{{navbar_menu_example}}{% endhighlight %}
  527. <div class="content">
  528. <p>
  529. 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.
  530. </p>
  531. </div>
  532. {% highlight html %}{{navbar_menu_active_example}}{% endhighlight %}
  533. <div class="content">
  534. <p>
  535. 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:
  536. </p>
  537. <ul>
  538. <li>
  539. <code>navbar-start</code>
  540. </li>
  541. <li>
  542. <code>navbar-end</code>
  543. </li>
  544. </ul>
  545. </div>
  546. <hr>
  547. <div id="navbarJsExample" class="message is-info">
  548. <h4 class="message-header">Javascript toggle</h4>
  549. <div class="message-body">
  550. <div class="content">
  551. <p>
  552. The Bulma package <strong>does not come with any JavaScript</strong>.
  553. <br>
  554. 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>.
  555. </p>
  556. {% highlight html %}{{ navbar_js_html }}{% endhighlight %}
  557. {% highlight javascript %}{{ navbar_js_code }}{% endhighlight %}
  558. </div>
  559. </div>
  560. </div>
  561. <hr>
  562. <h3 class="title">Navbar start and navbar end</h3>
  563. <div class="content">
  564. <p>
  565. The <code>navbar-start</code> and <code>navbar-end</code> are the two direct and only children of the <code>navbar-menu</code>.
  566. </p>
  567. <p>
  568. On desktop {% include bp/desktop.html %}:
  569. </p>
  570. <ul>
  571. <li>
  572. <code>navbar-start</code> will appear on the <strong>left</strong>
  573. </li>
  574. <li>
  575. <code>navbar-end</code> will appear on the <strong>right</strong>
  576. </li>
  577. </ul>
  578. <p>
  579. Each of them can contain any number of <code>navbar-item</code>.
  580. </p>
  581. </div>
  582. {% highlight html %}{{navbar_start_end_example}}{% endhighlight %}
  583. <hr>
  584. <h3 class="title">Navbar item</h3>
  585. <div class="content">
  586. <p>
  587. A <code>navbar-item</code> is a repeatable element that can be:
  588. </p>
  589. <ul>
  590. <li>
  591. a navigation <strong>link</strong>
  592. {% highlight html %}{{ navbar_item_link_example }}{% endhighlight %}
  593. </li>
  594. <li>
  595. a container for the <strong>brand logo</strong>
  596. {% highlight html %}{{ navbar_item_brand_example }}{% endhighlight %}
  597. </li>
  598. <li>
  599. the <strong>parent</strong> of a dropdown menu
  600. {% highlight html %}{{ navbar_item_dropdown_example }}{% endhighlight %}
  601. </li>
  602. <li>
  603. a child of a <strong>navbar dropdown</strong>
  604. {% highlight html %}{{ navbar_item_dropdown_bis_example }}{% endhighlight %}
  605. </li>
  606. <li>
  607. a container for almost <strong>anything</strong> you want, like a <code>field</code>
  608. {% highlight html %}{{ navbar_item_other_example }}{% endhighlight %}
  609. </li>
  610. </ul>
  611. <p>
  612. It can either be an anchor tag <code>&lt;a&gt;</code> or a <code>&lt;div&gt;</code>, as a <strong>direct child</strong> of either:
  613. </p>
  614. <ul>
  615. <li>
  616. <code>navbar</code>
  617. </li>
  618. <li>
  619. <code>navbar-brand</code>
  620. </li>
  621. <li>
  622. <code>navbar-start</code>
  623. </li>
  624. <li>
  625. <code>navbar-end</code>
  626. </li>
  627. <li>
  628. <code>navbar-dropdown</code>
  629. </li>
  630. </ul>
  631. </div>
  632. <hr>
  633. <h3 id="transparent-navbar" class="title">Transparent navbar</h3>
  634. <div class="content">
  635. <p>
  636. To seamlessly integrate the navbar in any visual context, you can add the <code>is-transparent</code> modifer on the <code>navbar</code> component. This will remove any hover or active background from the navbar items.
  637. </p>
  638. </div>
  639. <div class="example is-paddingless">
  640. {{navbar_transparent_example}}
  641. </div>
  642. {% highlight html %}{{navbar_transparent_example}}{% endhighlight %}
  643. <hr>
  644. <h3 id="dropdown-menu" class="title">Dropdown menu</h3>
  645. <div class="content">
  646. <p>
  647. To create a <strong>dropdown menu</strong>, you will need <strong>4</strong> elements:
  648. </p>
  649. <ul>
  650. <li>
  651. <code>navbar-item</code> with the <code>has-dropdown</code> modifier
  652. </li>
  653. <li>
  654. <code>navbar-link</code> which contains the dropdown arrow
  655. </li>
  656. <li>
  657. <code>navbar-dropdown</code> which can contain instances of <code>navbar-item</code> and <code>navbar-divider</code>
  658. </li>
  659. </ul>
  660. </div>
  661. <div class="columns">
  662. <div class="column">
  663. <div class="example is-paddingless">
  664. {{ navbar_dropdown_example }}
  665. </div>
  666. </div>
  667. <div class="column">
  668. {% highlight html %}{{ navbar_dropdown_example }}{% endhighlight %}
  669. </div>
  670. </div>
  671. <h4 class="title is-4">
  672. Show/hide the dropdown with either <strong>CSS</strong> or <strong>JavaScript</strong>
  673. </h4>
  674. <div class="content">
  675. <p>
  676. 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.
  677. </p>
  678. <p>
  679. The <code>navbar-item</code> with the <code>has-dropdown</code> modifier, has <strong>2 additional modifiers</strong>
  680. </p>
  681. <ul>
  682. <li>
  683. <code>is-hoverable</code>: the dropdown will show up when <strong>hovering</strong> the parent <code>navbar-item</code>
  684. </li>
  685. <li>
  686. <code>is-active</code>: the dropdown will show up <strong>all the time</strong>
  687. </li>
  688. </ul>
  689. </div>
  690. <div class="message is-success">
  691. <p class="message-body">
  692. 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>.
  693. </p>
  694. </div>
  695. <div class="columns">
  696. <div class="column">
  697. <div class="example is-paddingless">
  698. {{ navbar_dropdown_hover_example }}
  699. </div>
  700. </div>
  701. <div class="column">
  702. {% highlight html %}{{ navbar_dropdown_hover_example }}{% endhighlight %}
  703. </div>
  704. </div>
  705. <div class="columns">
  706. <div class="column">
  707. <div class="example is-paddingless">
  708. {{ navbar_dropdown_active_example }}
  709. </div>
  710. </div>
  711. <div class="column">
  712. {% highlight html %}{{ navbar_dropdown_active_example }}{% endhighlight %}
  713. </div>
  714. </div>
  715. <h4 class="title is-4">
  716. Styles for the dropdown menu
  717. </h4>
  718. <div class="content">
  719. <p>
  720. By default, the <code>navbar-dropdown</code> has:
  721. </p>
  722. <ul>
  723. <li>
  724. a grey <code>border-top</code>
  725. </li>
  726. <li>
  727. a <code>border-radius</code> at both bottom corners
  728. </li>
  729. </ul>
  730. </div>
  731. <div class="columns">
  732. <div class="column">
  733. <div class="example is-paddingless">
  734. {{ navbar_dropdown_default_example }}
  735. </div>
  736. </div>
  737. <div class="column">
  738. {% highlight html %}{{ navbar_dropdown_default_example }}{% endhighlight %}
  739. </div>
  740. </div>
  741. <div class="content">
  742. <p>
  743. 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.
  744. </p>
  745. <ul>
  746. <li>
  747. the grey border is <strong>removed</strong>
  748. </li>
  749. <li>
  750. a slight <strong>inner shadow</strong> is added
  751. </li>
  752. <li>
  753. all corners are <strong>rounded</strong>
  754. </li>
  755. <li>
  756. the hover/active state is <strong>animated</strong>
  757. </li>
  758. </ul>
  759. </div>
  760. <div class="columns">
  761. <div class="column">
  762. <div class="example is-paddingless">
  763. {{ navbar_dropdown_boxed_example }}
  764. </div>
  765. </div>
  766. <div class="column">
  767. {% highlight html %}{{ navbar_dropdown_boxed_example }}{% endhighlight %}
  768. </div>
  769. </div>
  770. <h4 class="title is-4">
  771. Active dropdown navbar item
  772. </h4>
  773. <div class="columns">
  774. <div class="column">
  775. <div class="example is-paddingless">
  776. {{ navbar_dropdown_item_active_example }}
  777. </div>
  778. </div>
  779. <div class="column">
  780. {% highlight html %}{{ navbar_dropdown_item_active_example }}{% endhighlight %}
  781. </div>
  782. </div>
  783. <h4 class="title is-4">
  784. Dropdown divider
  785. </h4>
  786. <div class="content">
  787. <p>
  788. You can add a <code>navbar-divider</code> to display a <strong>horizontal rule</strong> in a <code>navbar-dropdown</code>.
  789. </p>
  790. </div>
  791. {% highlight html %}{{ navbar_divider_example }}{% endhighlight %}
  792. {% include variables.html %}
  793. </div>
  794. </section>