question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Responsive navbar

See original GitHub issue

Hi guys, This library is just an awesome box to start with angular while dependent on bootstrap css. I’m creating a navbar and just got through an issue here. Probably it’s a new-feature request or it can be said as a bootstrap-feature not yet in ng-bootstrap.

Feature description:

Look at this link where you can set collapsible navbar based on the size of the screen. Bootstrap 4 documentation for navbar

This can be seen in responsive navbar section of this link. To the point, it actually uses navbar-toggleable-xs class to define this functionality. The navbar comes collapsible only when the screen size is xs, otherwise, its a regular navbar.

Version of Angular, ng-bootstrap, and Bootstrap:

Angular2: 2.0.1

ng-bootstrap: 1.0.0-alpha.6

Bootstrap: 4.0.0-alpha.4

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:30 (5 by maintainers)

github_iconTop GitHub Comments

39reactions
jnizetcommented, Sep 15, 2016

Hi @ravipunjwani

We already have the NgbCollapse directive to do that. Replace the bootstrap example by the following snippet, and you’ll have the equivalent.

Is there something more needed?

<nav class="navbar navbar-light bg-faded">
  <button class="navbar-toggler hidden-sm-up" type="button" (click)="isNavbarCollapsed = !isNavbarCollapsed" aria-controls="exCollapsingNavbar2" aria-expanded="false" aria-label="Toggle navigation">
    &#9776;
  </button>
  <div [ngbCollapse]="isNavbarCollapsed" class="collapse navbar-toggleable-xs" id="exCollapsingNavbar2">
    <a class="navbar-brand" href="#">Responsive navbar</a>
    <ul class="nav navbar-nav">
      <li class="nav-item active">
        <a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="#">Features</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="#">Pricing</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="#">About</a>
      </li>
    </ul>
  </div>
</nav>
18reactions
pkozlowski-opensourcecommented, Aug 14, 2017
Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Create a Responsive Top Navigation Menu
Learn how to create a responsive top navigation menu with CSS and JavaScript. Responsive Navigation Bar. Resize the browser window to see how...
Read more >
How to Build a Responsive Navigation Bar Using HTML and ...
Calling all beginner web devs: this tutorial will give you the skills you need to create your own respsonive navbars using just HTML...
Read more >
Pure CSS Responsive Navbar - CodePen
A responsive collapsible navbar in pure css...
Read more >
How to Create a Responsive Navbar Using Material UI and ...
In this article, we will be looking at how to create a responsive navigation bar using the Material UI component and adapt it...
Read more >
Responsive Navigation Bar with mobile menu using HTML ...
Any website on the web should be responsive in the modern web era. One of the must-do task is to create a navigation...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found