List Nav
BsListNav is a component used for displaying a series of item and mainly used for navigation. It can contain an icon, nested items, and provides a consistent styling for organizing the items. But doesn't have the flexibility like BsListTile.
Overview
<bs-list-nav>
is a component to create the navigation container and <bs-list-nav-item>
is used to create the navigation menu. <bs-list-nav>
needs to be placed inside <bs-list-view>
, then use <bs-list-nav-item>
to compose the navigation menus. The navigation menus created by <bs-list-nav-item>
has consistent styling and meets the Material Design specifications.
TIP
See BsIcon to learn more about how to apply the Google Material Icons to icon
property.
INFO
Since Vue MDBootstrap v2.1.0, Google Material Icons are replaced with Google Material Symbols.
Styling
Color
We can also make <bs-list-nav>
to have a background color other than white. To achieve this, we need to set the color
property of <bs-list-view>
component to the desired color name.
TIP
Any MDBootstrap Color variants and Material Color variants can be applied to the color
property.
Outer padding
Additionally, we can also add predefined outer padding on the left or right side of the navigation menus. To create the padding, sets the space-around
property of the <bs-list-view>
component with value: left
, right
or both
.
Item border
We can also give a border to the active navigation's menu. To achieve this, sets the item-border-variant
property of <bs-list-view>
component with value: left
, right
, left-right
, top
, bottom
, or top-bottom
.
Rounded style
Additionaly, we can also add additional style appearance to the navigation's menu. There are two built-in style appearance, which are: Rounded and Rounded Pill. To achieve this, sets the item-rounded
property of <bs-list-view>
explicitly to create rounded style, or item-rounded-pill
to create rounded pill style to an active navigation menu.
Usage Example
The following are a collection of examples that demonstrate more advanced use of the <bs-list-nav>
.
Nested navigation
To create nested navigation list, the child navigation list needs to be wrapped by <bs-list-nav>
and placed inside current <bs-list-nav-item>
. Optionally, we can define the depth
or indent
property to customize the indentation from the left side.
Mixed with List Tile
<bs-list-nav>
can also be mixed with <bs-list-tile>
to display custom and fine tune navigation menus.
Inside Side Drawer
<bs-list-nav>
can also be used inside <bs-side-drawer>
to create side navigation menus.
CSS Variables
Added since v2.0.0List View
--md-listview-padding-x: 0;
--md-listview-padding-y: 0.5rem;
--md-listview-bg: #{$color};
List Nav
--md-nav-item-padding-x: 1rem;
--md-nav-item-padding-y: 0.25rem;
--md-nav-item-line-height: normal;
--md-nav-item-font-size: 1rem;
--md-nav-item-font-weight: 400;
--md-nav-item-color: #{$tile-title-color};
--md-nav-item-divider-color: #{$divider-color};
--md-nav-item-icon-color: #{$tile-leading-color};
--md-nav-item-expanded-bg: #{$nav-item-expanded-bg};
--md-nav-item-active-bg: #{$tile-active-bg};
--md-nav-item-active-color: #{$tile-active-title-color};
--md-nav-item-active-icon-color: #{$tile-active-leading-icon-color};
--md-nav-item-active-font-weight: 500;
--md-nav-item-disable-color: #{$tile-disable-title-color};
--md-nav-item-disable-icon-color: #{$tile-disable-leading-color};
--md-nav-item-hover-bg: #{$tile-hover-bg};
API Reference
BsListView
Property | Type | Default | Description |
---|---|---|---|
color | String | 'white' | ListView color appearance. Any MDBootstrap Color or Material Color variants can be used. |
individual-state | Boolean | false | The ListView doesn't manage each ListTile's state. v2.0.0 |
item-rounded | Boolean | false | Apply rounded style to the BsListNavItem or BsListTile. v2.0.0 |
item-rounded-pill | Boolean | false | Apply rounded pill style to the BsListNavItem or BsListTile. v2.0.0 |
item-border-variant | String | Give border around the active item. Valid values are: left , right , left-right , top , bottom , top-bottom . v2.0.0 | |
model-value v-model | IListItem | Property that hold the ListView's active item object instance. v2.0.0 | |
overflow-hidden | Boolean | false | Apply css 'overflow-hidden' or not. |
single-expand | Boolean | true | If false then more than one item can be expanded. Only applicable to BsListNav. |
space-around | String | Give padding around each item. Valid values are: both , left , right . |
Name | Arguments | Description |
---|---|---|
change | ( value:IListItem , oldValue: IListItem ) | Fired immediately when this component's mutate its model-value . v2.0.0 |
update:model-value | ( value:IListItem ) | Fired when this component's model-value is updated. v2.0.0 |
Name | Description |
---|---|
default | The outlet slot used to place the main content. |
BsListNav
Property | Type | Default | Description |
---|---|---|---|
child | Boolean | false | Treat the ListNav as child Navigation menus. |
Name | Description |
---|---|
default | The outlet slot used to place the main content. |
BsListNavItem
Property | Type | Default | Description |
---|---|---|---|
active v-model | Boolean | false | Component state and monitored by v-model . |
active-class | String | 'active' | <router-link> property, configure the active CSS class applied when the link is active. Typically you will want to set this to class name active . |
badge | String | The text to render as badge label. | |
badge-color | String | The badge color appearance. v2.0.0 | |
badge-type | String | Create Badge with pill or label style. v2.0.0 | |
badge-variant | String | The badge variant, valid values: primary , secondary , success , danger , warning , info , light , dark . | |
border-off | Boolean | false | Remove border style that have been applied via BsListView to this BsListNavItem. v2.0.0 |
depth | Number | Item depth level in tree hierarchy (zero based level). | |
disabled | Boolean | false | Component state. |
icon | String | Icon to display inside the component. Updated on v2.1.0 Use any valid android icon name from Google Material Symbols with or without a suffix. Valid suffixes are: icon-variant property. | |
icon-flip | String | Flip the icon, valid values are: horizontal , vertical , both . | |
icon-pulse | Boolean | false | Apply pulse animation to the icon. |
icon-rotation | Number | Rotate the icon, valid values are: 90 , 180 , 270 . | |
icon-size | Number /String | Render the icon at predefined size in pixel. | |
icon-spin | Boolean | false | Apply spin animation to the icon. |
icon-variant | String | 'outlined' | Use predefined icon style variant. Valid values are: outlined , rounded , sharp , filled , outlined_filled , rounded_filled , and sharp_filled . v2.1.0 |
id | String | Sets the component ID . This property value is auto generate. v2.0.0 | |
indent | Number | Text indentation from left side. | |
label required | String | The text label to display. | |
location | RouteLocationAsRelativeGeneric | The navigation location target. v2.0.11 The value must be an object that satisfies the to property of the <RouterLink> component. This is a shortcut to create a <RouterLink> inside the component. See vue-router for more information. | |
path | String | The route path for the navigation target. This is a shortcut to create a <RouterLink> inside the component. See vue-router for more information. | |
path-name | String | The path name for the navigation target. v2.0.11 This is a shortcut to create a <RouterLink> inside the component. See vue-router for more information. | |
pill-off | Boolean | false | Remove rounded pill style that have been applied via BsListView to this BsListNavItem. v2.0.0 |
ripple-off | Boolean | false | Disabled ripple effect. |
rounded-off | Boolean | false | Remove rounded style that have been applied via BsListView to this BsListNavItem. v2.0.0 |
url | String | Absolute or relative URL for the navigation target, when vue-router doesn't exists. |
Name | Arguments | Description |
---|---|---|
click | ( evt:Event ) | Fired when a non-disabled ListNavItem is clicked. |
update:active | ( value:Boolean ) | Fired when this component's state is updated. v2.0.0 |
Name | Description |
---|---|
default | The outlet slot used to place the child navigation. |