Navigational components for building navigation menus such as lists, tabs, or vertical navigation. You can use these classes to create responsive navigation bars and menus.
Here’s a basic example of a navigation component. You can customize the appearance by using the different classes provided.
<ul class="nav"> <li class="nav-item"> <a href="#">link</a> </li> <li class="nav-item"> <a href="#">link</a> </li> <li class="nav-item active"> <a href="#">link</a> </li> <li class="nav-item disabled"> <a href="#">disabled</a> </li> </ul>
To align the navigation items to the right, use the justify-content-end class. This makes the items spread across the available width.
<ul class="nav justify-content-end"> <li class="nav-item"> <a href="#">link</a> </li> <li class="nav-item"> <a href="#">link</a> </li> <li class="nav-item active"> <a href="#">link</a> </li> <li class="nav-item disabled"> <a href="#">disabled</a> </li> </ul>
For vertical navigation, you can use the flex-column class, which makes the list items stack vertically.
<ul class="nav flex-column"> <li class="nav-item"> <a href="#">link</a> </li> <li class="nav-item"> <a href="#">link</a> </li> <li class="nav-item active"> <a href="#">link</a> </li> <li class="nav-item disabled"> <a href="#">disabled</a> </li> </ul>
To create a vertical navigation bar and align it to the right, use both flex-column and align-items-end.
<ul class="nav flex-column align-items-end"> <li class="nav-item"> <a href="#">link</a> </li> <li class="nav-item"> <a href="#">link</a> </li> <li class="nav-item active"> <a href="#">link</a> </li> <li class="nav-item disabled"> <a href="#">disabled</a> </li> </ul>
The SCSS code for this component ensures flexibility and customization. Here’s how the styles are structured:
.nav {
@extend .w-100, .d-flex, .flex-row, .gap-1;
& .nav-item {
@extend .p-1, .all-border-small;
&.active {
color: get-color(on-primary);
background-color: get-color(primary);
& a {
color: get-color(on-primary);
}
}
&.disabled, &.disabled * {
user-select: none;
cursor: default;
color: get-color(disabled-regular);
}
& * {
@extend .pointer;
}
& a {
@extend .text-color;
}
}
&:not([class*="align-items"]) {
@extend .align-items-start;
}
&:not(.flex-column) {
@extend .flex-row;
}
}
The SCSS structure for the navigation component is designed to provide flexibility in layout and styling. Here is an overview of the key classes and their functionalities:
Class | Description |
---|---|
.nav | The container style for the navigation, setting flexible width and layout. |
.nav-item | Each item within the navigation bar, including padding and border styles. |
.active | Applies the active state to an item, with color themes for background and text. |
.disabled | Disables interaction for the item, preventing clicks and modifying the cursor. |