The v-navigation-drawer
component is what your users will utilize to navigate through the application. The navigation-drawer is pre-configured to work with or without vue-router right out the box. For the purpose of display, some examples are wrapped in a v-card
element. Within your application you will generally place the v-navigation-drawer
as a direct child of v-app
.
If you are using v-navigation-drawer
with app
property enabled, you don't need to use absolute
prop as in examples.
Select your desired component from below and see the available props, slots, events and functions.
Applies position: absolute to the component.
Designates the component as part of the application layout. Used for dynamically adjusting content sizing. Components using this prop should reside outside of v-main
component to function properly. You can more information about layouts on the application page. Note: this prop automatically applies position: fixed to the layout element. You can overwrite this functionality by using the absolute
prop
Expands from the bottom of the screen on mobile devices
A clipped drawer rests under the application toolbar
Applies specified color to the control - it can be the name of material color (for example success
or purple
) or css color (#033
or rgba(255, 0, 0, 0.5)
). You can find list of built in classes on the colors page.
Applies the dark theme variant to the component. You can find more information on the Material Design documentation for dark themes.
Will automatically open/close drawer when resized depending if mobile or desktop.
Disables opening of navigation drawer when route changes
Collapses the drawer to a mini-variant until hovering with the mouse
Applies position: fixed to the component.
A floating drawer has no visible container (no border-right)
Sets the height of the navigation drawer
Hides the display of the overlay.
Applies the light theme variant to the component.
Condenses navigation drawer width, also accepts the .sync modifier. With this, the drawer will re-open when clicking it
Designates the width assigned when the mini
prop is turned on
Sets the designated mobile breakpoint for the component. This will apply alternate styles for mobile devices such as the temporary
prop, or activate the bottom
prop when the breakpoint value is met. Setting the value to 0
will disable this functionality.
Sets the overlay color.
Sets the overlay opacity.
The drawer remains visible regardless of screen size
Places the navigation drawer on the right
Specifies a v-img as the component's background.
Remove all automated state functionality (resize, mobile, route) and manually control the drawer state
Specify a custom tag used on the root element.
A temporary drawer sits above its application and uses a scrim (overlay) to darken the background
Disable mobile touch functionality
Controls whether the component is visible or hidden.
Sets the width for the component.
A slot at the bottom of the drawer
The default Vue slot.
Used to modify v-img
properties when using the src prop
{
height: string
src: string | srcObject
}
A slot at the top of the drawer
The updated bound model
boolean
Emits event object when transition is complete.
object
The mini-variant.sync
event
boolean
1px !default;
16 !default;
Below is a collection of simple to complex examples.
Navigation drawers can be customized to fit any application's design. Here we apply a custom background color and an appended content area using the append slot.
By default, a navigation drawer has a 1px right border that separates it from content. In this example we want to detach the drawer from the left side and let it float on its own. The floating property removes the right border (or left if using right).
When using the mini-variant prop, the drawer will shrink (default 56px) and hide everything inside of v-list
except the first element. In this example we use the .sync modifier that allows us to tie the expanding/contracting of the drawer programmatically.
A temporary drawer sits above its application and uses a scrim (overlay) to darken the background. This drawer behavior is mimicked by default when on mobile. Clicking outside of the drawer will cause it to close.
Navigation drawers can also be positioned on the right side of your application (or an element). This is also useful for creating a side-sheet with auxillary information that may not have any navigation links. When using RTL you must explicitly define right for your drawer.
Places the component in mini-variant mode and expands once hovered. Does not alter the content area. To have content area respond to expand-on-hover bind mini-variant.sync to a boolean. Width can be controlled with the mini-variant-width property.
Apply a custom background to your drawer. If you need to customize v-img
's properties you can use the img slot.
In this example we define a custom width to accommodate our nested drawer. Using v-row
we ensure that the drawer and list stack horizontally next to each other.
Using the bottom prop, we are able to relocate our drawer on mobile devices to come from the bottom of the screen. This is an alternative style and only activates once the mobile-breakpoint is met.
Ready for more? Continue reading with: