Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between MatSidenav and the MatDrawer?

They can be found both on the same documentation page, but it seems to be the same. You know the difference from a functional perspective? What is the benefit using one over the other?

https://material.angular.io/components/sidenav/overview

Thanks first for reading.

like image 359
Ling Vu Avatar asked Apr 07 '20 06:04

Ling Vu


People also ask

What is a Sidenav?

Overview for sidenav. Angular Material provides two sets of components designed to add collapsible side content (often navigation, though it can be any content) alongside some primary content. These are the sidenav and drawer components. The sidenav components are designed to add side content to a fullscreen app.

What is mat drawer container?

MatDrawerContainer. <mat-drawer-container> component. This is the parent component to one or two <mat-drawer> s that validates the state internally and coordinates the backdrop and content styling. Selector: mat-drawer-container. Exported as: matDrawerContainer.

What is fixedInViewport?

fixedInViewport does set position to fixed . So on it's own it does something. Depending on the rest of the styles, that position could definitely have an effect.


1 Answers

From the documentation:

The sidenav components are designed to add side content to a fullscreen app.

VS

The drawer component is designed to add side content to a small section of your app.

^ Emphasis is mine

The difference between the two components is that the sidenav component should be used for a global drawer (like a navigation drawer) while the drawer component should be used for content specific to the small portion of your app (such as allowing the user to filter files).

like image 58
Edric Avatar answered Sep 21 '22 04:09

Edric