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.

container class for Navbar?

See original GitHub issue

container is a class to limit the width of page display.

Is there any way to add container class to Navbar? Just like Github Navbar.

When I add the container to the Navbar directly, it cut off the background, which is not pretty.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
alextrasterocommented, Mar 14, 2018

Formatted:

render () {
  const {
    brand,
    className,
    fixed,
    left,
    right,
    href,
    container, //container prop
    ...other
  } = this.props;

  delete other.options;

  let classes = {
    right: right,
    'hide-on-med-and-down': true
  };

  let brandClasses = {
    'brand-logo': true,
    right: left
  };

  let wrapper = 'nav-wrapper';

  if (container) {
    wrapper = 'nav-wrapper container'; //add container to the nav-wrapper
  }

  let content = (
    <nav {...other} className={className}>
      <div className={wrapper}>
        <Col s={12}>
          <a href={href} className={cx(brandClasses)}>{brand}</a>
          <ul className={cx(className, classes)}>
            {this.props.children}
          </ul>
          {this.renderSideNav()}
          <a className='button-collapse' href='#' data-activates='nav-mobile'>
            <Icon>view_headline</Icon>
          </a>
        </Col>
      </div>
    </nav>
  );

  if (fixed) {
    content = <div className='navbar-fixed'>{content}</div>;
  }

  return content;
}

Navbar.propTypes = {
  ...
  /**
   * Makes the navbar fixed
   */
  fixed: PropTypes.bool,
  /*
   * adds container to Navbar
   */
  container: PropTypes.bool
0reactions
alextrasterocommented, Mar 24, 2019

Please try react-materialize3.x and reopen if this is still happening, thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Navbar - Bootstrap
Use optional containers to limit their horizontal width. Use our spacing and flex utility classes for controlling spacing and alignment within navbars. Navbars ......
Read more >
bootstrap navbar container - code helper
Examples of usage of the containers in bootstrap navbar component. ... <nav class="navbar navbar-expand-lg navbar-dark secondary-color">.
Read more >
Navbar and Container - html - Stack Overflow
I have a navbar in a container-class-div because i want in desktop-view the nav not touching the edge of monitor, but in mobile-view...
Read more >
Bootstrap 4: How to Make Top Fixed Navbar Stay in Container ...
There are many ways to make a fixed navbar stay inside a parent's div container. We'll go over the most straightforward one here....
Read more >
Bootstrap Navigation Bar - W3Schools
A standard navigation bar is created with <nav class="navbar ... Note that we have added a .form-group class to the div container holding...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

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