The base c-nav component is built with flexbox and provide a strong
foundation for building all types of navigation components. It includes some style
overrides (for working with lists), some link padding for larger hit areas, and basic
[disabled]="true" styling.
Classes are used throughout, so your markup can be super flexible. Use
c-nav-item like above, or roll your own with a <c-nav> element. Because
the .nav uses display: flex, the cNavLink behaves the same as c-nav-item
would, but
without the extra markup.
Change the horizontal alignment of your nav with flexbox utilities . By default, navs are left-aligned, but you can easily change them to center or right aligned.
Centered with .justify-content-center:
Right-aligned with .justify-content-end:
Stack your navigation by changing the flex item direction with the
.flex-column utility. Need to stack them on some viewports but not
others? Use the responsive versions (e.g., .flex-sm-column).
Take the basic nav from above and add the variant="tabs" class
to generate a tabbed interface
Take that same HTML, but use variant="pills" instead:
Take that same HTML, but use variant="Underline" instead:
Force your .nav's contents to extend the full available width one of
two modifier classes. To proportionately fill all available space with your
.nav-items, use layout="fill". Notice that all
horizontal space is occupied, but not every nav item has the same width.
For equal-width elements, use layout="justified". All horizontal
space will be occupied by nav links, but unlike the .nav-fill above, every nav item
will be the same width.
If you need responsive nav variations, consider using a series of flexbox utilities. While more verbose, these utilities offer greater customization across responsive breakpoints. In the example below, our nav will be stacked on the lowest breakpoint, then adapt to a horizontal layout that fills the available width starting from the small breakpoint.