A powerful, responsive navigation header, the navbar. Includes support for branding, navigation, and more.
This is a pass through component from React-Bootstrap.
See React-Bootstrap for documentation.
Basic Usage#
Any Paragon component or export may be added to the code example.
<Navbar bg="light" expand="lg"><Navbar.Brand href="#home">React-Bootstrap</Navbar.Brand><Navbar.Toggle aria-controls="basic-navbar-nav" /><Navbar.Collapse id="basic-navbar-nav"><Nav className="mie-auto"><Nav.Link href="#home">Home</Nav.Link><Nav.Link href="#link">Link</Nav.Link><NavDropdown title="Dropdown" id="basic-nav-dropdown"><NavDropdown.Item href="#action/3.1">Action</NavDropdown.Item><NavDropdown.Item href="#action/3.2">Another action</NavDropdown.Item><NavDropdown.Item href="#action/3.3">Something</NavDropdown.Item><NavDropdown.Divider /><NavDropdown.Item href="#action/3.4">Separated link</NavDropdown.Item></NavDropdown></Nav><Form inline><FormControl type="text" placeholder="Search" /><Button variant="outline-success">Search</Button></Form></Navbar.Collapse></Navbar>
Theme Variables#
| CSS Variable | Computed Value |
|---|---|
| | |
| | |
| | |
| | |
| | |
Props API#
- as
elementTypeDefault'nav'Set a custom element for this component.
- bg
stringA convenience prop for adding
bg-*utility classes since they are so commonly used here.lightanddarkare common choices but anybg-*class is supported, including any custom ones you might define.Pairs nicely with the
variantprop. - collapseOnSelect
boolDefaultfalseToggles
expandedtofalseafter the onSelect event of a descendant of a child<Nav>fires. Does nothing if no<Nav>or<Nav>descendants exist.Manually controlling
expandedvia the onSelect callback is recommended instead, for more complex operations that need to be executed after theselectevent of<Nav>descendants. - expand
enumtrue | 'sm' | 'md' | 'lg' | 'xl'DefaulttrueThe breakpoint, below which, the Navbar will collapse. When
truethe Navbar will always be expanded regardless of screen size. - expanded
boolControls the visibility of the navbar body
- fixed
enum'top' | 'bottom'Create a fixed navbar along the top or bottom of the screen, that scrolls with the page. A convenience prop for the
fixed-*positioning classes. - onSelect
funcDefault() => {}A callback fired when a descendant of a child
<Nav>is selected. - onToggle
funcDefault() => {}A callback fired when the
<Navbar>body collapses or expands. Fired when a<Navbar.Toggle>is clicked and called with the newexpandedboolean value.Controls
expanded. - role
stringDefault'navigation'The ARIA role for the navbar, will default to 'navigation' for Navbars whose as is something other than
<nav>. - sticky
enum'top'Position the navbar at the top of the viewport, but only after scrolling past it. A convenience prop for the
sticky-toppositioning class. - variant
enum'light' | 'dark'Default'light'The general visual variant a the
Navbar. Use in combination with thebgprop,background-colorutilities, or your own background styles. - bsPrefix
stringDefault'navbar'Change the underlying component CSS base class name and modifier class names prefix.
- as
elementTypeDefault'nav'Set a custom element for this component.
- href
stringAn href, when provided the Brand will render as an
<a>element (unlessasis provided). - bsPrefix
stringDefault'navbar'Change the underlying component CSS base class name and modifier class names prefix.
- as
elementTypeDefault'button'Set a custom element for this component.
- children
nodeThe toggle content. When empty, the default toggle will be rendered.
- label
stringDefault'Toggle navigation'An accessible ARIA label for the toggler button.
- onClick
funcDefault() => {}Specifies the callback function when the toggle is clicked.
- bsPrefix
stringDefault'navbar-toggler'Change the underlying component CSS base class name and modifier class names prefix.
- bsPrefix
stringDefault'navbar-collapse'Change the underlying component CSS base class name and modifier class names prefix.
Usage Insights#
Navbar
| frontend-app-admin-portal | 21.13.1 | 1 | |
| frontend-app-learner-portal-enterprise | 21.13.1 | 1 |
NavbarBrand
| frontend-app-learner-portal-enterprise | 21.13.1 | 1 |