Navigation Rail for M3E
npm install @m3e/nav-railm3e-nav-rail component extends @m3e/nav-bar to provide a vertical navigation rail and interactive items for switching between primary destinations in your application. Designed for larger devices, the nav rail supports compact and expanded modes, orientation, selection, and extensive theming via CSS custom properties.
bash
npm install @m3e/nav-rail
`
๐ป Editor Integration
This package includes a Custom Elements Manifest to support enhanced editor tooling and developer experience.
$3
To enable autocomplete and hover documentation for @m3e/nav-rail, install the Custom Elements Manifest Language Server extension. It will automatically detect the manifest bundled with this package and surface tag names, attributes, slots, and events in supported files.
Alternately, you can explicitly reference the html-custom-data.json and css-custom-data.json in your workspace settings:
`json
{
"html.customData": ["./node_modules/@m3e/nav-rail/dist/html-custom-data.json"],
"css.customData": ["./node_modules/@m3e/nav-rail/dist/css-custom-data.json"]
}
`
๐ Native Module Support
This package uses JavaScript Modules. To use it directly in a browser without a bundler, use a module script similar to the following.
`html
`
In addition, you must use an import map to include dependencies.
`html
`
> For production, use index.min.js, a11y.min.js, and layout.min.js for faster load times.
๐๏ธ Elements
- m3e-nav-rail โ A vertical bar, typically used on larger devices, that allows a user to switch between views.
๐งช Example
The following example illustrates a nav rail whose expanded state is automatically determined by the current screen size. In addition, a toggle button is used to allow the user to manually toggle the expanded state.
`html
Extended
News
Global
For you
Trending
`
๐ API Reference
This section details the attributes, slots, events and CSS custom properties available for the m3e-nav-rail component.
$3
| Attribute | Type | Default | Description |
| --------- | --------------------------------- | ------- | -------------------------------------------------- |
| mode | "compact" \| "expanded" \| "auto" | auto | The mode in which items in the rail are presented. |
$3
| Event | Description |
| ------ | --------------------------------------------------- |
| change | Emitted when the selected state of an item changes. |
$3
| Slot | Description |
| ----------- | ------------------------------ |
| _(default)_ | Renders the items of the rail. |
$3
| Property | Description |
| ------------------------------------------- | ----------------------------------------------- |
| --m3e-nav-rail-top-space | Top block padding for the nav rail. |
| --m3e-nav-rail-bottom-space | Bottom block padding for the nav rail. |
| --m3e-nav-rail-compact-width | Width of the nav rail in compact mode. |
| --m3e-nav-rail-expanded-inline-padding | Inline padding for expanded nav rail. |
| --m3e-nav-rail-expanded-min-width | Minimum width of the nav rail in expanded mode. |
| --m3e-nav-rail-expanded-max-width | Maximum width of the nav rail in expanded mode. |
| --m3e-nav-rail-expanded-item-height | Height of nav items in expanded mode. |
| --m3e-nav-rail-button-item-space | Space below icon buttons and FABs. |
| --m3e-nav-rail-expanded-icon-button-inset | Inset for icon buttons in expanded mode. |
๐ค Contributing
See the root monorepo CONTRIBUTING.md` for guidelines on contributing to this package.