Se usa para seleccionar entre 5 o más vistas.
Se usa en:
Móvil
Tablet
Escritorio
Algunos diseñadores prefieren usar pestañas, barras de navegación o navigation rail.
Se crea el elemento personalizado
nav-drw.
Puedes ver su código en
m-js/m-nav-drw-js.html
Coloca el botón
is="md-menu-button",
dentro del
md-top-app-bar
con
slot="navigation".
Coloca
nav-drw
hasta el final.
| 1 | <!DOCTYPE html> |
| 2 | <html lang="es" class="light dark"> |
| 3 | |
| 4 | <head> |
| 5 | |
| 6 | <meta charset="UTF-8"> |
| 7 | <title>Vista secundaria - PWA con MD</title> |
| 8 | |
| 9 | <script src="js/registraServiceWorker.js"></script> |
| 10 | |
| 11 | <meta name="viewport" content="width=device-width"> |
| 12 | <meta name="theme-color" content="#fffbfe"> |
| 13 | <link rel="icon" sizes="32x32" href="favicon.ico"> |
| 14 | <link rel="manifest" href="site.webmanifest"> |
| 15 | <script src="ungap/custom-elements.js"></script> |
| 16 | |
| 17 | <script type="module" src="js/configura.js"></script> |
| 18 | <link rel="stylesheet" href="css/estilos.css"> |
| 19 | <link rel="stylesheet" href="css/transicion_completa.css"> |
| 20 | |
| 21 | </head> |
| 22 | |
| 23 | <body> |
| 24 | |
| 25 | <md-top-app-bar class="medium" headline="h1Headline"> |
| 26 | |
| 27 | <h1>Secundaria</h1> |
| 28 | |
| 29 | <button is="md-menu-button" slot="navigation"></button> |
| 30 | |
| 31 | <button type="button" class="md-standard-icon-button" title="Agregar" |
| 32 | slot="action"> |
| 33 | <span class="material-symbols-outlined">add</span> |
| 34 | </button> |
| 35 | |
| 36 | <button type="button" class="md-standard-icon-button" title="Editar" |
| 37 | slot="action"> |
| 38 | <span class="material-symbols-outlined">edit</span> |
| 39 | </button> |
| 40 | |
| 41 | <button is="md-overflow-button" slot="action" |
| 42 | onclick="overflow.alterna(this)"></button> |
| 43 | |
| 44 | </md-top-app-bar> |
| 45 | |
| 46 | <h1 id="h1Headline">Página secundaria</h1> |
| 47 | |
| 48 | <main> |
| 49 | <p> |
| 50 | Esta es una página secundaria de la app. Las X que siguen son para que veas |
| 51 | como se comporta cuando se hace scroll. |
| 52 | </p> |
| 53 | <p>x</p> |
| 54 | <p>x</p> |
| 55 | <p>x</p> |
| 56 | <p>x</p> |
| 57 | <p>x</p> |
| 58 | <p>x</p> |
| 59 | <p>x</p> |
| 60 | <p>x</p> |
| 61 | <p>x</p> |
| 62 | <p>x</p> |
| 63 | <p>x</p> |
| 64 | <p>x</p> |
| 65 | <p>x</p> |
| 66 | <p>x</p> |
| 67 | <p>x</p> |
| 68 | <p>x</p> |
| 69 | <p>x</p> |
| 70 | <p>x</p> |
| 71 | <p>x</p> |
| 72 | <p>x</p> |
| 73 | <p>x</p> |
| 74 | <p>x</p> |
| 75 | <p>x</p> |
| 76 | </main> |
| 77 | |
| 78 | <md-overflow-menu id="overflow"> |
| 79 | |
| 80 | <button type="button"> |
| 81 | <span class="material-symbols-outlined">star</span> |
| 82 | Marcar favorito |
| 83 | </button> |
| 84 | |
| 85 | <button type="button"> |
| 86 | <span class="material-symbols-outlined"> delete</span> |
| 87 | Eliminar |
| 88 | </button> |
| 89 | |
| 90 | </md-overflow-menu> |
| 91 | |
| 92 | <nav-drw></nav-drw> |
| 93 | |
| 94 | </body> |
| 95 | |
| 96 | </html> |
El cajón de navegación está definido en https://m3.material.io/components/navigation-drawer/overview.
El navigation rail está definido en https://m3.material.io/components/navigation-rail/overview.