navbar.html 32 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156
  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="bd-example" %}
  64. {% endcapture %}
  65. {% capture navbar_brand_example %}
  66. <nav class="navbar" role="navigation" aria-label="main navigation">
  67. <div class="navbar-brand">
  68. <!-- navbar items, navbar burger ... -->
  69. </div>
  70. </nav>
  71. {% endcapture %}
  72. {% capture navbar_burger_example %}
  73. <button class="button navbar-burger">
  74. <span></span>
  75. <span></span>
  76. <span></span>
  77. </button>
  78. {% endcapture %}
  79. {% capture navbar_brand_items_example %}
  80. <nav class="navbar" role="navigation" aria-label="main navigation">
  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. <button class="button navbar-burger">
  86. <span></span>
  87. <span></span>
  88. <span></span>
  89. </button>
  90. </div>
  91. </nav>
  92. {% endcapture %}
  93. {% capture navbar_menu_example %}
  94. <nav class="navbar" role="navigation" aria-label="main navigation">
  95. <div class="navbar-brand">
  96. <!-- navbar items, navbar 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" alt="Bulma">
  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" aria-hidden="true"></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" aria-hidden="true"></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" role="navigation" aria-label="dropdown navigation">
  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_snippet %}
  198. <div class="navbar-item has-dropdown is-hoverable">
  199. <!-- navbar-link, navbar-dropdown etc. -->
  200. </div>
  201. {% endcapture %}
  202. {% capture navbar_dropdown_hover_example %}
  203. <nav class="navbar" role="navigation" aria-label="dropdown navigation">
  204. <div class="navbar-item has-dropdown is-hoverable">
  205. <a class="navbar-link">
  206. Docs
  207. </a>
  208. <div class="navbar-dropdown">
  209. <a class="navbar-item">
  210. Overview
  211. </a>
  212. <a class="navbar-item">
  213. Elements
  214. </a>
  215. <a class="navbar-item">
  216. Components
  217. </a>
  218. <hr class="navbar-divider">
  219. <div class="navbar-item">
  220. Version {{ site.version }}
  221. </div>
  222. </div>
  223. </div>
  224. </nav>
  225. {% endcapture %}
  226. {% capture navbar_dropdown_active_snippet %}
  227. <div class="navbar-item has-dropdown is-active">
  228. <!-- navbar-link, navbar-dropdown etc. -->
  229. </div>
  230. {% endcapture %}
  231. {% capture navbar_dropdown_active_example %}
  232. <nav class="navbar" role="navigation" aria-label="dropdown navigation">
  233. <div class="navbar-item has-dropdown is-active">
  234. <a class="navbar-link">
  235. Docs
  236. </a>
  237. <div class="navbar-dropdown">
  238. <a class="navbar-item">
  239. Overview
  240. </a>
  241. <a class="navbar-item">
  242. Elements
  243. </a>
  244. <a class="navbar-item">
  245. Components
  246. </a>
  247. <hr class="navbar-divider">
  248. <div class="navbar-item">
  249. Version {{ site.version }}
  250. </div>
  251. </div>
  252. </div>
  253. </nav>
  254. {% endcapture %}
  255. {% capture navbar_dropdown_right_snippet %}
  256. <div class="navbar-dropdown is-right">
  257. <!-- navbar-item, navbar-divider etc. -->
  258. </div>
  259. {% endcapture %}
  260. {% capture navbar_dropdown_right_example %}
  261. <nav class="navbar" role="navigation" aria-label="dropdown navigation">
  262. <div class="navbar-menu">
  263. <div class="navbar-start">
  264. <div class="navbar-item has-dropdown is-active">
  265. <a class="navbar-link">
  266. Left
  267. </a>
  268. <div class="navbar-dropdown">
  269. <a class="navbar-item">
  270. Overview
  271. </a>
  272. <a class="navbar-item">
  273. Elements
  274. </a>
  275. <a class="navbar-item">
  276. Components
  277. </a>
  278. <hr class="navbar-divider">
  279. <div class="navbar-item">
  280. Version {{ site.version }}
  281. </div>
  282. </div>
  283. </div>
  284. </div>
  285. <div class="navbar-end">
  286. <div class="navbar-item has-dropdown is-active">
  287. <a class="navbar-link">
  288. Right
  289. </a>
  290. <div class="navbar-dropdown is-right">
  291. <a class="navbar-item">
  292. Overview
  293. </a>
  294. <a class="navbar-item">
  295. Elements
  296. </a>
  297. <a class="navbar-item">
  298. Components
  299. </a>
  300. <hr class="navbar-divider">
  301. <div class="navbar-item">
  302. Version {{ site.version }}
  303. </div>
  304. </div>
  305. </div>
  306. </div>
  307. </div>
  308. </nav>
  309. <section class="hero is-primary">
  310. <div class="hero-body">
  311. <p class="title">
  312. Documentation
  313. </p>
  314. <p class="subtitle">
  315. Everything you need to <strong>create a website</strong> with Bulma
  316. </p>
  317. </div>
  318. </section>
  319. {% endcapture %}
  320. {% capture navbar_dropdown_default_example %}
  321. <nav class="navbar" role="navigation" aria-label="dropdown navigation">
  322. <a class="navbar-item">
  323. <img src="{{ site.url }}/images/bulma-logo.png" alt="{{ site.title }}" width="112" height="28">
  324. </a>
  325. <div class="navbar-item has-dropdown is-active">
  326. <a class="navbar-link">
  327. Docs
  328. </a>
  329. <div class="navbar-dropdown">
  330. <a class="navbar-item">
  331. Overview
  332. </a>
  333. <a class="navbar-item">
  334. Elements
  335. </a>
  336. <a class="navbar-item">
  337. Components
  338. </a>
  339. <hr class="navbar-divider">
  340. <div class="navbar-item">
  341. Version {{ site.version }}
  342. </div>
  343. </div>
  344. </div>
  345. </nav>
  346. <section class="hero is-primary">
  347. <div class="hero-body">
  348. <p class="title">
  349. Documentation
  350. </p>
  351. <p class="subtitle">
  352. Everything you need to <strong>create a website</strong> with Bulma
  353. </p>
  354. </div>
  355. </section>
  356. {% endcapture %}
  357. {% capture navbar_dropdown_boxed_example %}
  358. <nav class="navbar is-transparent" role="navigation" aria-label="dropdown navigation">
  359. <a class="navbar-item">
  360. <img src="{{ site.url }}/images/bulma-logo.png" alt="{{ site.title }}" width="112" height="28">
  361. </a>
  362. <div class="navbar-item has-dropdown is-active">
  363. <a class="navbar-link">
  364. Docs
  365. </a>
  366. <div class="navbar-dropdown is-boxed">
  367. <a class="navbar-item">
  368. Overview
  369. </a>
  370. <a class="navbar-item">
  371. Elements
  372. </a>
  373. <a class="navbar-item">
  374. Components
  375. </a>
  376. <hr class="navbar-divider">
  377. <div class="navbar-item">
  378. Version {{ site.version }}
  379. </div>
  380. </div>
  381. </div>
  382. </nav>
  383. <section class="hero">
  384. <div class="hero-body">
  385. <p class="title">
  386. Documentation
  387. </p>
  388. <p class="subtitle">
  389. Everything you need to <strong>create a website</strong> with Bulma
  390. </p>
  391. </div>
  392. </section>
  393. {% endcapture %}
  394. {% capture navbar_dropdown_item_active_example %}
  395. <nav class="navbar" role="navigation" aria-label="dropdown navigation">
  396. <a class="navbar-item">
  397. <img src="{{ site.url }}/images/bulma-logo.png" alt="{{ site.title }}" width="112" height="28">
  398. </a>
  399. <div class="navbar-item has-dropdown is-active">
  400. <a class="navbar-link">
  401. Docs
  402. </a>
  403. <div class="navbar-dropdown">
  404. <a class="navbar-item">
  405. Overview
  406. </a>
  407. <a class="navbar-item is-active">
  408. Elements
  409. </a>
  410. <a class="navbar-item">
  411. Components
  412. </a>
  413. <hr class="navbar-divider">
  414. <div class="navbar-item">
  415. Version {{ site.version }}
  416. </div>
  417. </div>
  418. </div>
  419. </nav>
  420. <section class="hero is-primary">
  421. <div class="hero-body">
  422. <p class="title">
  423. Documentation
  424. </p>
  425. <p class="subtitle">
  426. Everything you need to <strong>create a website</strong> with Bulma
  427. </p>
  428. </div>
  429. </section>
  430. {% endcapture %}
  431. {% capture navbar_divider_example %}
  432. <hr class="navbar-divider">
  433. {% endcapture %}
  434. {% capture navbar_js_html %}
  435. <button class="button navbar-burger" data-target="navMenu">
  436. <span></span>
  437. <span></span>
  438. <span></span>
  439. </button>
  440. <div class="navbar-menu" id="navMenu">
  441. <!-- navbar-start, navbar-end... -->
  442. </div>
  443. {% endcapture %}
  444. {% capture navbar_js_code %}
  445. document.addEventListener('DOMContentLoaded', function () {
  446. // Get all "navbar-burger" elements
  447. var $navbarBurgers = Array.prototype.slice.call(document.querySelectorAll('.navbar-burger'), 0);
  448. // Check if there are any navbar burgers
  449. if ($navbarBurgers.length > 0) {
  450. // Add a click event on each of them
  451. $navbarBurgers.forEach(function ($el) {
  452. $el.addEventListener('click', function () {
  453. // Get the target from the "data-target" attribute
  454. var target = $el.dataset.target;
  455. var $target = document.getElementById(target);
  456. // Toggle the class on both the "navbar-burger" and the "navbar-menu"
  457. $el.classList.toggle('is-active');
  458. $target.classList.toggle('is-active');
  459. });
  460. });
  461. }
  462. });
  463. {% endcapture %}
  464. {% capture navbar_color_default %}
  465. <nav class="navbar">
  466. <div class="navbar-brand">
  467. <a class="navbar-item" href="{{ site.url }}">
  468. <img src="{{ site.url }}/images/bulma-logo-white.png" alt="Bulma: a modern CSS framework based on Flexbox" width="112" height="28">
  469. </a>
  470. <div class="navbar-burger burger" data-target="navMenuColorDefault-example">
  471. <span></span>
  472. <span></span>
  473. <span></span>
  474. </div>
  475. </div>
  476. <div id="navMenuColorDefault-example" class="navbar-menu">
  477. <div class="navbar-start">
  478. <div class="navbar-item has-dropdown is-active">
  479. <a class="navbar-link" href="/documentation/overview/start/">
  480. Docs
  481. </a>
  482. <div class="navbar-dropdown">
  483. <a class="navbar-item" href="/documentation/overview/start/">
  484. Overview
  485. </a>
  486. <a class="navbar-item" href="{{ site.url }}/documentation/modifiers/syntax/">
  487. Modifiers
  488. </a>
  489. <a class="navbar-item" href="{{ site.url }}/documentation/columns/basics/">
  490. Columns
  491. </a>
  492. <a class="navbar-item" href="{{ site.url }}/documentation/layout/container/">
  493. Layout
  494. </a>
  495. <a class="navbar-item" href="{{ site.url }}/documentation/form/general/">
  496. Form
  497. </a>
  498. <hr class="navbar-divider">
  499. <a class="navbar-item" href="{{ site.url }}/documentation/elements/box/">
  500. Elements
  501. </a>
  502. <a class="navbar-item is-active" href="{{ site.url }}/documentation/components/breadcrumb/">
  503. Components
  504. </a>
  505. </div>
  506. </div>
  507. </div>
  508. </div>
  509. </nav>
  510. {% endcapture %}
  511. {% capture navbar_color_primary %}
  512. <nav class="navbar is-info">
  513. <div class="navbar-brand">
  514. <a class="navbar-item" href="{{ site.url }}">
  515. <img src="{{ site.url }}/images/bulma-logo-white.png" alt="Bulma: a modern CSS framework based on Flexbox" width="112" height="28">
  516. </a>
  517. <div class="navbar-burger burger" data-target="navMenuColor-example">
  518. <span></span>
  519. <span></span>
  520. <span></span>
  521. </div>
  522. </div>
  523. <div id="navMenuColor-example" class="navbar-menu">
  524. <div class="navbar-start">
  525. <a class="navbar-item" href="{{ site.url }}/">
  526. Home
  527. </a>
  528. <div class="navbar-item has-dropdown is-active">
  529. <a class="navbar-link" href="/documentation/overview/start/">
  530. Docs
  531. </a>
  532. <div class="navbar-dropdown">
  533. <a class="navbar-item" href="/documentation/overview/start/">
  534. Overview
  535. </a>
  536. <a class="navbar-item" href="{{ site.url }}/documentation/modifiers/syntax/">
  537. Modifiers
  538. </a>
  539. <a class="navbar-item" href="{{ site.url }}/documentation/columns/basics/">
  540. Columns
  541. </a>
  542. <a class="navbar-item" href="{{ site.url }}/documentation/layout/container/">
  543. Layout
  544. </a>
  545. <a class="navbar-item" href="{{ site.url }}/documentation/form/general/">
  546. Form
  547. </a>
  548. <hr class="navbar-divider">
  549. <a class="navbar-item" href="{{ site.url }}/documentation/elements/box/">
  550. Elements
  551. </a>
  552. <a class="navbar-item is-active" href="{{ site.url }}/documentation/components/breadcrumb/">
  553. Components
  554. </a>
  555. </div>
  556. </div>
  557. </div>
  558. <div class="navbar-end">
  559. <div class="navbar-item">
  560. <div class="field is-grouped">
  561. <p class="control">
  562. <a class="bd-tw-button button" data-social-network="Twitter" data-social-action="tweet" data-social-target="http://localhost:4000" target="_blank" href="https://twitter.com/intent/tweet?text=Bulma: a modern CSS framework based on Flexbox&amp;hashtags=bulmaio&amp;url=http://localhost:4000&amp;via=jgthms">
  563. <span class="icon">
  564. <i class="fa fa-twitter"></i>
  565. </span>
  566. <span>
  567. Tweet
  568. </span>
  569. </a>
  570. </p>
  571. <p class="control">
  572. <a class="button is-primary" href="https://github.com/jgthms/bulma/archive/0.5.1.zip">
  573. <span class="icon">
  574. <i class="fa fa-download"></i>
  575. </span>
  576. <span>Download</span>
  577. </a>
  578. </p>
  579. </div>
  580. </div>
  581. </div>
  582. </div>
  583. </nav>
  584. {% endcapture %}
  585. <section class="section">
  586. <div class="container">
  587. <h1 class="title">Navbar</h1>
  588. <h2 class="subtitle">
  589. A responsive horizontal <strong>navbar</strong> that can supports images, links, buttons, and dropdowns
  590. </h2>
  591. {%
  592. include meta.html
  593. new=true
  594. since="0.4.3"
  595. colors=true
  596. sizes=false
  597. variables=true
  598. %}
  599. <hr>
  600. <div class="message is-success">
  601. <div class="message-body">
  602. <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>
  603. </div>
  604. </div>
  605. <div class="content">
  606. <p>
  607. The <code>navbar</code> component is a responsive and versatile horizontal navigation bar with the following structure:
  608. </p>
  609. <ul>
  610. <li>
  611. <code>navbar</code> the <strong>main</strong> container
  612. <ul>
  613. <li>
  614. <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
  615. <ul>
  616. <li>
  617. <code>navbar-burger</code> the <strong>hamburger</strong> icon, which toggles the navbar menu on touch devices
  618. </li>
  619. </ul>
  620. </li>
  621. <li>
  622. <code>navbar-menu</code> the <strong>right side</strong>, hidden on touch devices, visible on desktop
  623. <ul>
  624. <li>
  625. <code>navbar-start</code> the <strong>left part</strong> of the menu, which appears next to the navbar brand on desktop
  626. </li>
  627. <li>
  628. <code>navbar-end</code> the <strong>right part</strong> of the menu, which appears at the end of the navbar
  629. <ul>
  630. <li>
  631. <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>
  632. <ul>
  633. <li>
  634. <code>navbar-link</code> a <strong>link</strong> as the sibling of a dropdown, with an arrow
  635. </li>
  636. <li>
  637. <code>navbar-dropdown</code> the <strong>dropdown menu</strong>, which can include navbar items and dividers
  638. <ul>
  639. <li>
  640. <code>navbar-divider</code> a <strong>horizontal line</strong> to separate navbar items
  641. </li>
  642. </ul>
  643. </li>
  644. </ul>
  645. </li>
  646. </ul>
  647. </li>
  648. </ul>
  649. </li>
  650. </ul>
  651. </li>
  652. </ul>
  653. </div>
  654. <div class="bd-example is-paddingless">
  655. {{ navbar_color_default }}
  656. </div>
  657. {% highlight html %}{{ navbar_color_default }}{% endhighlight %}
  658. <div class="bd-example is-paddingless">
  659. {{ navbar_color_primary }}
  660. </div>
  661. {% highlight html %}{{ navbar_color_primary }}{% endhighlight %}
  662. {% include anchor.html name="Navbar brand" %}
  663. <div class="content">
  664. <p>
  665. The <code>navbar-brand</code> is the left side of the navbar. It can contain:
  666. </p>
  667. <ul>
  668. <li>
  669. a number of <code>navbar-item</code>
  670. </li>
  671. <li>
  672. the <code>navbar-burger</code> as last child
  673. </li>
  674. </ul>
  675. </div>
  676. {% highlight html %}{{navbar_brand_example}}{% endhighlight %}
  677. <div class="content">
  678. <p>
  679. 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.
  680. </p>
  681. </div>
  682. <div class="bd-example is-paddingless">
  683. {{navbar_brand_items_example}}
  684. </div>
  685. {% highlight html %}{{navbar_brand_items_example}}{% endhighlight %}
  686. <div class="content">
  687. <p>
  688. On desktop {% include bp/desktop.html %}, the navbar brand will only take up the space it needs.
  689. </p>
  690. </div>
  691. {% include anchor.html name="Navbar burger" %}
  692. <div class="content">
  693. <p>
  694. 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>.
  695. </p>
  696. </div>
  697. <div class="bd-example is-paddingless">
  698. <div class="navbar-burger" style="display: flex;">
  699. <span></span>
  700. <span></span>
  701. <span></span>
  702. </div>
  703. </div>
  704. {% highlight html %}{{ navbar_burger_example }}{% endhighlight %}
  705. <div class="content">
  706. <p>
  707. You can add the modifier class <code>is-active</code> to turn it into a cross.
  708. </p>
  709. </div>
  710. <div class="bd-example is-paddingless">
  711. <div class="navbar-burger is-active" style="display: flex;">
  712. <span></span>
  713. <span></span>
  714. <span></span>
  715. </div>
  716. </div>
  717. {% include anchor.html name="Navbar menu" %}
  718. <div class="content">
  719. <p>
  720. 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>.
  721. </p>
  722. </div>
  723. {% highlight html %}{{navbar_menu_example}}{% endhighlight %}
  724. <div class="content">
  725. <p>
  726. 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.
  727. </p>
  728. </div>
  729. {% highlight html %}{{navbar_menu_active_example}}{% endhighlight %}
  730. <div class="content">
  731. <p>
  732. 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:
  733. </p>
  734. <ul>
  735. <li>
  736. <code>navbar-start</code>
  737. </li>
  738. <li>
  739. <code>navbar-end</code>
  740. </li>
  741. </ul>
  742. </div>
  743. <hr>
  744. <div id="navbarJsExample" class="message is-info">
  745. <h4 class="message-header">Javascript toggle</h4>
  746. <div class="message-body">
  747. <div class="content">
  748. <p>
  749. The Bulma package <strong>does not come with any JavaScript</strong>.
  750. <br>
  751. 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>.
  752. </p>
  753. {% highlight html %}{{ navbar_js_html }}{% endhighlight %}
  754. {% highlight javascript %}{{ navbar_js_code }}{% endhighlight %}
  755. </div>
  756. </div>
  757. </div>
  758. {% include anchor.html name="Navbar start and navbar end" %}
  759. <div class="content">
  760. <p>
  761. The <code>navbar-start</code> and <code>navbar-end</code> are the two direct and only children of the <code>navbar-menu</code>.
  762. </p>
  763. <p>
  764. On desktop {% include bp/desktop.html %}:
  765. </p>
  766. <ul>
  767. <li>
  768. <code>navbar-start</code> will appear on the <strong>left</strong>
  769. </li>
  770. <li>
  771. <code>navbar-end</code> will appear on the <strong>right</strong>
  772. </li>
  773. </ul>
  774. <p>
  775. Each of them can contain any number of <code>navbar-item</code>.
  776. </p>
  777. </div>
  778. {% highlight html %}{{navbar_start_end_example}}{% endhighlight %}
  779. {% include anchor.html name="Navbar item" %}
  780. <div class="content">
  781. <p>
  782. A <code>navbar-item</code> is a repeatable element that can be:
  783. </p>
  784. <ul>
  785. <li>
  786. a navigation <strong>link</strong>
  787. {% highlight html %}{{ navbar_item_link_example }}{% endhighlight %}
  788. </li>
  789. <li>
  790. a container for the <strong>brand logo</strong>
  791. {% highlight html %}{{ navbar_item_brand_example }}{% endhighlight %}
  792. </li>
  793. <li>
  794. the <strong>parent</strong> of a dropdown menu
  795. {% highlight html %}{{ navbar_item_dropdown_example }}{% endhighlight %}
  796. </li>
  797. <li>
  798. a child of a <strong>navbar dropdown</strong>
  799. {% highlight html %}{{ navbar_item_dropdown_bis_example }}{% endhighlight %}
  800. </li>
  801. <li>
  802. a container for almost <strong>anything</strong> you want, like a <code>field</code>
  803. {% highlight html %}{{ navbar_item_other_example }}{% endhighlight %}
  804. </li>
  805. </ul>
  806. <p>
  807. 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:
  808. </p>
  809. <ul>
  810. <li>
  811. <code>navbar</code>
  812. </li>
  813. <li>
  814. <code>navbar-brand</code>
  815. </li>
  816. <li>
  817. <code>navbar-start</code>
  818. </li>
  819. <li>
  820. <code>navbar-end</code>
  821. </li>
  822. <li>
  823. <code>navbar-dropdown</code>
  824. </li>
  825. </ul>
  826. </div>
  827. {% include anchor.html name="Transparent navbar" %}
  828. <div class="content">
  829. <p>
  830. 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.
  831. </p>
  832. </div>
  833. <div class="bd-example is-paddingless">
  834. {{navbar_transparent_example}}
  835. </div>
  836. {% highlight html %}{{navbar_transparent_example}}{% endhighlight %}
  837. {% include anchor.html name="Dropdown menu" %}
  838. <div class="content">
  839. <p>
  840. To create a <strong>dropdown menu</strong>, you will need <strong>4</strong> elements:
  841. </p>
  842. <ul>
  843. <li>
  844. <code>navbar-item</code> with the <code>has-dropdown</code> modifier
  845. </li>
  846. <li>
  847. <code>navbar-link</code> which contains the dropdown arrow
  848. </li>
  849. <li>
  850. <code>navbar-dropdown</code> which can contain instances of <code>navbar-item</code> and <code>navbar-divider</code>
  851. </li>
  852. </ul>
  853. </div>
  854. <div class="columns">
  855. <div class="column">
  856. <div class="bd-example is-paddingless">
  857. {{ navbar_dropdown_example }}
  858. </div>
  859. </div>
  860. <div class="column">
  861. {% highlight html %}{{ navbar_dropdown_example }}{% endhighlight %}
  862. </div>
  863. </div>
  864. <h4 class="title is-4">
  865. Show/hide the dropdown with either <strong>CSS</strong> or <strong>JavaScript</strong>
  866. </h4>
  867. <div class="content">
  868. <p>
  869. 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.
  870. </p>
  871. <p>
  872. The <code>navbar-item</code> with the <code>has-dropdown</code> modifier, has <strong>2 additional modifiers</strong>
  873. </p>
  874. <ul>
  875. <li>
  876. <code>is-hoverable</code>: the dropdown will show up when <strong>hovering</strong> the parent <code>navbar-item</code>
  877. </li>
  878. <li>
  879. <code>is-active</code>: the dropdown will show up <strong>all the time</strong>
  880. </li>
  881. </ul>
  882. </div>
  883. <div class="message is-success">
  884. <p class="message-body">
  885. 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>.
  886. </p>
  887. </div>
  888. {% highlight html %}{{ navbar_dropdown_hover_snippet }}{% endhighlight %}
  889. <div class="columns">
  890. <div class="column">
  891. <div class="bd-example is-paddingless">
  892. {{ navbar_dropdown_hover_example }}
  893. </div>
  894. </div>
  895. <div class="column">
  896. {% highlight html %}{{ navbar_dropdown_hover_example }}{% endhighlight %}
  897. </div>
  898. </div>
  899. {% highlight html %}{{ navbar_dropdown_active_snippet }}{% endhighlight %}
  900. <div class="columns">
  901. <div class="column">
  902. <div class="bd-example is-paddingless">
  903. {{ navbar_dropdown_active_example }}
  904. </div>
  905. </div>
  906. <div class="column">
  907. {% highlight html %}{{ navbar_dropdown_active_example }}{% endhighlight %}
  908. </div>
  909. </div>
  910. <h4 class="title is-4">
  911. Right dropdown
  912. <span class="tag is-info">0.5.1</span>
  913. </h4>
  914. <div class="content">
  915. <p>
  916. 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.
  917. </p>
  918. </div>
  919. {% highlight html %}{{ navbar_dropdown_right_snippet }}{% endhighlight %}
  920. <div class="columns">
  921. <div class="column">
  922. <div class="bd-example is-paddingless">
  923. {{ navbar_dropdown_right_example }}
  924. </div>
  925. </div>
  926. <div class="column">
  927. {% highlight html %}{{ navbar_dropdown_right_example }}{% endhighlight %}
  928. </div>
  929. </div>
  930. <h4 class="title is-4">
  931. Styles for the dropdown menu
  932. </h4>
  933. <div class="content">
  934. <p>
  935. By default, the <code>navbar-dropdown</code> has:
  936. </p>
  937. <ul>
  938. <li>
  939. a grey <code>border-top</code>
  940. </li>
  941. <li>
  942. a <code>border-radius</code> at both bottom corners
  943. </li>
  944. </ul>
  945. </div>
  946. <div class="columns">
  947. <div class="column">
  948. <div class="bd-example is-paddingless">
  949. {{ navbar_dropdown_default_example }}
  950. </div>
  951. </div>
  952. <div class="column">
  953. {% highlight html %}{{ navbar_dropdown_default_example }}{% endhighlight %}
  954. </div>
  955. </div>
  956. <div class="content">
  957. <p>
  958. 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.
  959. </p>
  960. <ul>
  961. <li>
  962. the grey border is <strong>removed</strong>
  963. </li>
  964. <li>
  965. a slight <strong>inner shadow</strong> is added
  966. </li>
  967. <li>
  968. all corners are <strong>rounded</strong>
  969. </li>
  970. <li>
  971. the hover/active state is <strong>animated</strong>
  972. </li>
  973. </ul>
  974. </div>
  975. <div class="columns">
  976. <div class="column">
  977. <div class="bd-example is-paddingless">
  978. {{ navbar_dropdown_boxed_example }}
  979. </div>
  980. </div>
  981. <div class="column">
  982. {% highlight html %}{{ navbar_dropdown_boxed_example }}{% endhighlight %}
  983. </div>
  984. </div>
  985. <h4 class="title is-4">
  986. Active dropdown navbar item
  987. </h4>
  988. <div class="columns">
  989. <div class="column">
  990. <div class="bd-example is-paddingless">
  991. {{ navbar_dropdown_item_active_example }}
  992. </div>
  993. </div>
  994. <div class="column">
  995. {% highlight html %}{{ navbar_dropdown_item_active_example }}{% endhighlight %}
  996. </div>
  997. </div>
  998. <h4 class="title is-4">
  999. Dropdown divider
  1000. </h4>
  1001. <div class="content">
  1002. <p>
  1003. You can add a <code>navbar-divider</code> to display a <strong>horizontal rule</strong> in a <code>navbar-dropdown</code>.
  1004. </p>
  1005. </div>
  1006. {% highlight html %}{{ navbar_divider_example }}{% endhighlight %}
  1007. {% include anchor.html name="Colors" %}
  1008. <div class="tags has-addons">
  1009. <span class="tag">New!</span>
  1010. <span class="tag is-info">0.5.2</span>
  1011. </div>
  1012. <div class="bd-example is-paddingless">
  1013. {{ navbar_color_primary }}
  1014. </div>
  1015. {% highlight html %}{{ navbar_color_primary }}{% endhighlight %}
  1016. {% include variables.html %}
  1017. </div>
  1018. </section>