material-inspired-component-library 6.0.7 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -2
- package/components/appbar/index.scss +4 -4
- package/components/button/README.md +16 -1
- package/components/button/index.scss +6 -0
- package/components/button/index.ts +17 -0
- package/components/card/README.md +82 -11
- package/components/card/index.scss +169 -209
- package/components/datepicker/README.md +3 -2
- package/components/datepicker/index.ts +0 -8
- package/components/iconbutton/README.md +11 -0
- package/components/iconbutton/index.scss +12 -0
- package/components/iconbutton/index.ts +15 -0
- package/components/navigationrail/README.md +64 -59
- package/components/navigationrail/index.scss +197 -300
- package/components/navigationrail/index.ts +55 -38
- package/components/snackbar/README.md +126 -0
- package/components/snackbar/index.scss +94 -73
- package/components/snackbar/index.ts +90 -28
- package/components/timepicker/README.md +2 -1
- package/components/timepicker/index.ts +0 -3
- package/dist/appbar.css +1 -1
- package/dist/button.css +1 -1
- package/dist/card.css +1 -1
- package/dist/components/navigationrail/index.d.ts +2 -1
- package/dist/components/snackbar/index.d.ts +1 -0
- package/dist/iconbutton.css +1 -1
- package/dist/micl.css +1 -1
- package/dist/micl.js +1 -1
- package/dist/navigationrail.css +1 -1
- package/dist/snackbar.css +1 -1
- package/docs/button.html +43 -15
- package/docs/card.html +6 -5
- package/docs/datepicker.html +4 -4
- package/docs/iconbutton.html +22 -8
- package/docs/index.html +31 -18
- package/docs/micl.css +1 -1
- package/docs/micl.js +1 -1
- package/docs/navigationrail.html +76 -22
- package/docs/snackbar.html +31 -14
- package/docs/timepicker.html +12 -3
- package/package.json +1 -1
- package/docs/snackbar1.html +0 -159
- package/docs/snackbar2.html +0 -159
|
@@ -1,24 +1,22 @@
|
|
|
1
1
|
# Navigation rail
|
|
2
|
-
This component implements the [Material Design 3 Expressive Navigation rail](https://m3.material.io/components/navigation-rail/overview) design.
|
|
2
|
+
This component implements the [Material Design 3 Expressive Navigation rail](https://m3.material.io/components/navigation-rail/overview) design. A navigation rail houses destinations and functionality for the application.
|
|
3
3
|
|
|
4
4
|
## Basic Usage
|
|
5
5
|
|
|
6
6
|
### HTML
|
|
7
|
-
To create a simple navigation rail, use a `<nav>` element with the `micl-navigationrail` class. Inside, use
|
|
7
|
+
To create a simple navigation rail, use a `<nav>` element with the `micl-navigationrail` class. Inside, use anchor elements `<a>` to create the selectable navigation items.
|
|
8
8
|
|
|
9
9
|
```HTML
|
|
10
10
|
<nav id="mynavigationrail" class="micl-navigationrail">
|
|
11
|
-
<div class="micl-navigationrail__content">
|
|
12
|
-
<
|
|
13
|
-
<label for="item1" class="micl-navigationrail__item" tabindex="0">
|
|
11
|
+
<div class="micl-navigationrail__content" role="menu">
|
|
12
|
+
<a href="#" class="micl-navigationrail__item" role="menuitem" aria-current="page">
|
|
14
13
|
<span class="micl-navigationrail__icon material-symbols-outlined" aria-hidden="true">inbox</span>
|
|
15
14
|
<span class="micl-navigationrail__text">Inbox</span>
|
|
16
|
-
</
|
|
17
|
-
<
|
|
18
|
-
<label for="item2" class="micl-navigationrail__item" tabindex="0">
|
|
15
|
+
</a>
|
|
16
|
+
<a href="#" class="micl-navigationrail__item" role="menuitem">
|
|
19
17
|
<span class="micl-navigationrail__icon material-symbols-outlined" aria-hidden="true">outbox</span>
|
|
20
18
|
<span class="micl-navigationrail__text">Outbox</span>
|
|
21
|
-
</
|
|
19
|
+
</a>
|
|
22
20
|
</div>
|
|
23
21
|
</nav>
|
|
24
22
|
```
|
|
@@ -53,12 +51,16 @@ The basic example creates a **collapsed** navigation rail. Add a menu button to
|
|
|
53
51
|
<div class="micl-navigationrail__headline">
|
|
54
52
|
<button
|
|
55
53
|
type="button"
|
|
54
|
+
id="mybutton"
|
|
56
55
|
class="micl-iconbutton-standard-s micl-button--toggle material-symbols-outlined"
|
|
57
|
-
|
|
56
|
+
command="--micl-toggle"
|
|
57
|
+
commandfor="mybutton"
|
|
58
|
+
data-miclicon="menu"
|
|
59
|
+
data-micliconselected="menu_open"
|
|
58
60
|
aria-label="Toggle navigation rail"
|
|
59
|
-
|
|
61
|
+
></button>
|
|
60
62
|
</div>
|
|
61
|
-
<div class="micl-navigationrail__content">
|
|
63
|
+
<div class="micl-navigationrail__content" role="menu">
|
|
62
64
|
...
|
|
63
65
|
</div>
|
|
64
66
|
</nav>
|
|
@@ -66,59 +68,33 @@ The basic example creates a **collapsed** navigation rail. Add a menu button to
|
|
|
66
68
|
|
|
67
69
|
When the user clicks the menu button, the navigation rail is expanded and the toggle button is given the `micl-button--selected` class and the `micl-button--toggled` class that indicates that the toggle button has been clicked at least once.
|
|
68
70
|
|
|
69
|
-
### Popover expanded navigation rail
|
|
70
|
-
|
|
71
|
-
Add the `popover` attribute to the navigation rail, and the `popovertarget` attribute to the menu button. The value of the `popovertarget` attribute must be the `id` of the navigation rail.
|
|
72
|
-
|
|
73
|
-
```HTML
|
|
74
|
-
<nav id="mynavigationrail" class="micl-navigationrail" popover="manual">
|
|
75
|
-
<div class="micl-navigationrail__headline">
|
|
76
|
-
<button
|
|
77
|
-
type="button"
|
|
78
|
-
class="micl-iconbutton-standard-s micl-button--toggle material-symbols-outlined"
|
|
79
|
-
popovertarget="mynavigationrail"
|
|
80
|
-
data-miclalt="menu_open"
|
|
81
|
-
aria-label="Toggle navigation rail"
|
|
82
|
-
>menu</button>
|
|
83
|
-
</div>
|
|
84
|
-
<div class="micl-navigationrail__content">
|
|
85
|
-
...
|
|
86
|
-
</div>
|
|
87
|
-
</nav>
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
> [!WARNING]
|
|
91
|
-
> The **popover** navigation rail component adds CSS rules to the element with the `.micl-window` class to properly resize the main content area when the navigation rail is collapsed. Overriding these rules may cause the component to behave unexpectedly. The rules that are applied are:
|
|
92
|
-
>
|
|
93
|
-
> ```CSS
|
|
94
|
-
> margin-inline-start: var(--md-sys-navigationrail-collapsed-width);
|
|
95
|
-
> ```
|
|
96
|
-
|
|
97
71
|
### Modal navigation rail
|
|
98
72
|
|
|
99
73
|
A **modal** navigation rail is hidden until the user clicks a menu button. When shown, the **expanded** navigation rail is displayed on top of other page content. Use a `<dialog>` element instead of a `<nav>`.
|
|
100
74
|
|
|
101
75
|
```HTML
|
|
102
|
-
<dialog id="mynavigationrail" class="micl-navigationrail" closedby="closerequest">
|
|
76
|
+
<dialog id="mynavigationrail" class="micl-navigationrail" closedby="closerequest" aria-modal="true">
|
|
103
77
|
<div class="micl-navigationrail__headline">
|
|
104
78
|
<button
|
|
105
79
|
type="button"
|
|
106
|
-
class="micl-iconbutton-standard-s
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
aria-label="
|
|
110
|
-
|
|
80
|
+
class="micl-iconbutton-standard-s material-symbols-outlined"
|
|
81
|
+
command="close"
|
|
82
|
+
commandfor="mynavigationrail"
|
|
83
|
+
aria-label="Close navigation rail"
|
|
84
|
+
autofocus
|
|
85
|
+
>menu_open</button>
|
|
111
86
|
</div>
|
|
112
|
-
<div class="micl-navigationrail__content">
|
|
87
|
+
<div class="micl-navigationrail__content" role="menu">
|
|
113
88
|
...
|
|
114
89
|
</div>
|
|
115
90
|
</dialog>
|
|
116
91
|
|
|
117
92
|
<button
|
|
118
93
|
type="button"
|
|
119
|
-
class="micl-iconbutton-standard-s
|
|
120
|
-
|
|
121
|
-
|
|
94
|
+
class="micl-iconbutton-standard-s material-symbols-outlined"
|
|
95
|
+
command="show-modal"
|
|
96
|
+
commandfor="mynavigationrail"
|
|
97
|
+
aria-label="Open navigation rail"
|
|
122
98
|
>menu</button>
|
|
123
99
|
```
|
|
124
100
|
|
|
@@ -129,27 +105,56 @@ You can customize the appearance of the Navigation rail component by overriding
|
|
|
129
105
|
|
|
130
106
|
| Variable name | Default Value | Description |
|
|
131
107
|
| ------------- | ------------- | ----------- |
|
|
132
|
-
| --md-
|
|
133
|
-
| --md-
|
|
134
|
-
|
|
108
|
+
| --md-comp-nav-rail-divider-thickness | 0px | The width of the vertical divider at the end of the rail |
|
|
109
|
+
| --md-comp-nav-rail-divider-color | | The color of the vertical divider |
|
|
110
|
+
|
|
111
|
+
The Navigation rail component supports the following CSS variables, as defined in the [Material Design 3 Expressive Navigation rail Specification](https://m3.material.io/components/navigation-rail/specs):
|
|
112
|
+
|
|
113
|
+
```CSS
|
|
114
|
+
--md-comp-nav-rail-item-icon-size
|
|
115
|
+
--md-comp-nav-rail-item-active-indicator-leading-space
|
|
116
|
+
--md-comp-nav-rail-item-active-indicator-icon-label-space
|
|
117
|
+
--md-comp-nav-rail-item-active-indicator-trailing-space
|
|
118
|
+
--md-comp-nav-rail-item-container-height
|
|
119
|
+
--md-comp-nav-rail-item-short-container-height
|
|
120
|
+
--md-comp-nav-rail-item-container-shape
|
|
121
|
+
--md-comp-nav-rail-item-container-vertical-space
|
|
122
|
+
--md-comp-nav-rail-item-header-space-minimum
|
|
123
|
+
--md-comp-nav-rail-collapsed-container-width
|
|
124
|
+
--md-comp-nav-rail-collapsed-narrow-container-width
|
|
125
|
+
--md-comp-nav-rail-collapsed-container-elevation
|
|
126
|
+
--md-comp-nav-rail-collapsed-container-shape
|
|
127
|
+
--md-comp-nav-rail-collapsed-container-color
|
|
128
|
+
--md-comp-nav-rail-collapsed-item-vertical-space
|
|
129
|
+
--md-comp-nav-rail-collapsed-top-space
|
|
130
|
+
--md-comp-nav-rail-expanded-container-width-minimum
|
|
131
|
+
--md-comp-nav-rail-expanded-container-width-maximum
|
|
132
|
+
--md-comp-nav-rail-expanded-top-space
|
|
133
|
+
--md-comp-nav-rail-expanded-container-elevation
|
|
134
|
+
--md-comp-nav-rail-expanded-modal-container-elevation
|
|
135
|
+
--md-comp-nav-rail-expanded-container-color
|
|
136
|
+
--md-comp-nav-rail-expanded-modal-container-color
|
|
137
|
+
--md-comp-nav-rail-expanded-container-shape
|
|
138
|
+
--md-comp-nav-rail-expanded-modal-container-shape
|
|
139
|
+
--md-comp-nav-rail-item-vertical-active-indicator-height
|
|
140
|
+
--md-comp-nav-rail-item-vertical-active-indicator-width
|
|
141
|
+
--md-comp-nav-rail-item-horizontal-full-width-leading-space
|
|
142
|
+
```
|
|
135
143
|
|
|
136
144
|
**Example: Changing the width of the collapsed navigation rail**
|
|
137
145
|
|
|
138
146
|
```HTML
|
|
139
|
-
<div style="--md-
|
|
147
|
+
<div style="--md-comp-nav-rail-collapsed-container-width:80px">
|
|
140
148
|
<nav id="mynavigationrail" class="micl-navigationrail">
|
|
141
149
|
...
|
|
142
150
|
</nav>
|
|
143
151
|
</div>
|
|
144
152
|
```
|
|
145
153
|
|
|
146
|
-
To add a vertical divider of the to the navigation rail,
|
|
154
|
+
To add a vertical divider of the to the navigation rail, set the following CSS variable:
|
|
147
155
|
|
|
148
156
|
```CSS
|
|
149
157
|
#mynavigationrail {
|
|
150
|
-
--md-
|
|
158
|
+
--md-comp-nav-rail-divider-thickness: 1px;
|
|
151
159
|
}
|
|
152
160
|
```
|
|
153
|
-
|
|
154
|
-
## Compatibility
|
|
155
|
-
This component uses the Popover API, which might not be supported in all browsers. Please check [Browser compatibility](https://developer.mozilla.org/en-US/docs/Web/API/Popover_API#api.htmlelement.popover) for details.
|