material-inspired-component-library 1.3.0 → 2.0.1
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/CODE_OF_CONDUCT.md +128 -0
- package/README.md +9 -1
- package/components/badge/README.md +65 -0
- package/components/badge/index.scss +61 -0
- package/components/bottomsheet/README.md +29 -17
- package/components/bottomsheet/index.scss +23 -23
- package/components/bottomsheet/index.ts +25 -24
- package/components/button/README.md +1 -1
- package/components/button/index.scss +10 -12
- package/components/button/index.ts +5 -0
- package/components/card/index.scss +2 -2
- package/components/checkbox/index.scss +1 -1
- package/components/dialog/README.md +9 -9
- package/components/iconbutton/index.scss +2 -2
- package/components/iconbutton/index.ts +5 -0
- package/components/list/index.scss +2 -2
- package/components/navigationrail/README.md +110 -59
- package/components/navigationrail/index.scss +399 -88
- package/components/{checkbox → navigationrail}/index.ts +12 -7
- package/components/radio/index.scss +2 -2
- package/components/sidesheet/README.md +32 -17
- package/components/sidesheet/index.scss +43 -47
- package/components/slider/README.md +5 -5
- package/dist/badge.css +1 -0
- package/dist/badge.js +1 -0
- package/dist/bottomsheet.css +1 -1
- package/dist/button.css +1 -1
- package/dist/card.css +1 -1
- package/dist/checkbox.css +1 -1
- package/dist/components/navigationrail/index.d.ts +5 -0
- package/dist/iconbutton.css +1 -1
- package/dist/list.css +1 -1
- package/dist/micl.css +1 -1
- package/dist/micl.js +1 -1
- package/dist/navigationrail.css +1 -1
- package/dist/radio.css +1 -1
- package/dist/sidesheet.css +1 -1
- package/docs/bottomsheet.html +58 -7
- package/docs/button.html +30 -30
- package/docs/docs.css +2 -1
- package/docs/index.html +35 -4
- package/docs/micl.css +1 -1
- package/docs/micl.js +1 -1
- package/docs/navigationrail.html +48 -42
- package/docs/sidesheet.html +22 -7
- package/micl.ts +20 -27
- package/package.json +4 -1
- package/styles.scss +17 -0
- package/dist/components/checkbox/index.d.ts +0 -5
|
@@ -53,12 +53,15 @@ button.micl-button-outlined-xl {
|
|
|
53
53
|
--md-sys-button-motion-effects: #{motion.$md-sys-motion-expressive-fast-spatial};
|
|
54
54
|
--md-sys-button-motion-duration: #{motion.$md-sys-motion-expressive-fast-spatial-duration};
|
|
55
55
|
--md-sys-button-motion-duration-reverse: #{motion.$md-sys-motion-expressive-fast-spatial-duration};
|
|
56
|
-
--
|
|
56
|
+
--micl-ripple: 1;
|
|
57
57
|
|
|
58
|
+
position: relative;
|
|
59
|
+
display: inline-flex;
|
|
60
|
+
align-items: center;
|
|
58
61
|
padding: 0;
|
|
59
62
|
border: none;
|
|
60
63
|
background-image:
|
|
61
|
-
radial-gradient(circle at var(--x, center) var(--y, center), transparent 0%, rgb(from var(--statelayer-color) r g b / var(--statelayer-opacity)) 10%, transparent 10%),
|
|
64
|
+
radial-gradient(circle at var(--micl-x, center) var(--micl-y, center), transparent 0%, rgb(from var(--statelayer-color) r g b / var(--statelayer-opacity)) 10%, transparent 10%),
|
|
62
65
|
linear-gradient(rgb(from var(--statelayer-color) r g b / var(--statelayer-opacity)));
|
|
63
66
|
background-repeat: no-repeat;
|
|
64
67
|
background-size: 10000%, 100%;
|
|
@@ -97,6 +100,7 @@ button.micl-button-tonal-xs,
|
|
|
97
100
|
button.micl-button-outlined-xs {
|
|
98
101
|
@include typography.label-large;
|
|
99
102
|
|
|
103
|
+
column-gap: 8px;
|
|
100
104
|
min-width: var(--md-sys-target-size);
|
|
101
105
|
height: var(--md-sys-target-size);
|
|
102
106
|
padding-inline: 12px;
|
|
@@ -134,8 +138,6 @@ button.micl-button-outlined-xs {
|
|
|
134
138
|
.micl-button__icon {
|
|
135
139
|
font-size: 20px;
|
|
136
140
|
width: 20px;
|
|
137
|
-
margin-right: 8px;
|
|
138
|
-
vertical-align: text-bottom;
|
|
139
141
|
}
|
|
140
142
|
}
|
|
141
143
|
|
|
@@ -146,6 +148,7 @@ button.micl-button-tonal-s,
|
|
|
146
148
|
button.micl-button-outlined-s {
|
|
147
149
|
@include typography.label-large;
|
|
148
150
|
|
|
151
|
+
column-gap: 8px;
|
|
149
152
|
min-width: var(--md-sys-target-size);
|
|
150
153
|
height: var(--md-sys-target-size);
|
|
151
154
|
padding-inline: 16px;
|
|
@@ -183,8 +186,6 @@ button.micl-button-outlined-s {
|
|
|
183
186
|
.micl-button__icon {
|
|
184
187
|
font-size: 20px;
|
|
185
188
|
width: 20px;
|
|
186
|
-
margin-right: 8px;
|
|
187
|
-
vertical-align: text-bottom;
|
|
188
189
|
}
|
|
189
190
|
}
|
|
190
191
|
|
|
@@ -195,6 +196,7 @@ button.micl-button-tonal-m,
|
|
|
195
196
|
button.micl-button-outlined-m {
|
|
196
197
|
@include typography.title-medium;
|
|
197
198
|
|
|
199
|
+
column-gap: 8px;
|
|
198
200
|
min-width: 56px;
|
|
199
201
|
height: 56px;
|
|
200
202
|
padding-inline: 24px;
|
|
@@ -218,8 +220,6 @@ button.micl-button-outlined-m {
|
|
|
218
220
|
.micl-button__icon {
|
|
219
221
|
font-size: 24px;
|
|
220
222
|
width: 24px;
|
|
221
|
-
margin-right: 8px;
|
|
222
|
-
vertical-align: text-bottom;
|
|
223
223
|
}
|
|
224
224
|
}
|
|
225
225
|
|
|
@@ -230,6 +230,7 @@ button.micl-button-tonal-l,
|
|
|
230
230
|
button.micl-button-outlined-l {
|
|
231
231
|
@include typography.headline-small;
|
|
232
232
|
|
|
233
|
+
column-gap: 12px;
|
|
233
234
|
min-width: 96px;
|
|
234
235
|
height: 96px;
|
|
235
236
|
padding-inline: 48px;
|
|
@@ -253,8 +254,6 @@ button.micl-button-outlined-l {
|
|
|
253
254
|
.micl-button__icon {
|
|
254
255
|
font-size: 32px;
|
|
255
256
|
width: 32px;
|
|
256
|
-
margin-right: 12px;
|
|
257
|
-
vertical-align: text-bottom;
|
|
258
257
|
}
|
|
259
258
|
}
|
|
260
259
|
|
|
@@ -265,6 +264,7 @@ button.micl-button-tonal-xl,
|
|
|
265
264
|
button.micl-button-outlined-xl {
|
|
266
265
|
@include typography.headline-large;
|
|
267
266
|
|
|
267
|
+
column-gap: 16px;
|
|
268
268
|
min-width: 136px;
|
|
269
269
|
height: 136px;
|
|
270
270
|
padding-inline: 64px;
|
|
@@ -288,8 +288,6 @@ button.micl-button-outlined-xl {
|
|
|
288
288
|
.micl-button__icon {
|
|
289
289
|
font-size: 40px;
|
|
290
290
|
width: 40px;
|
|
291
|
-
margin-right: 16px;
|
|
292
|
-
vertical-align: text-bottom;
|
|
293
291
|
}
|
|
294
292
|
}
|
|
295
293
|
|
|
@@ -37,7 +37,12 @@ export default (() =>
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
if (event.target.classList.contains('micl-button--toggle')) {
|
|
40
|
+
event.target.classList.add('micl-button--toggled');
|
|
40
41
|
event.target.classList.toggle('micl-button--selected');
|
|
42
|
+
if (!!event.target.dataset.miclalt) {
|
|
43
|
+
[event.target.textContent, event.target.dataset.miclalt] =
|
|
44
|
+
[event.target.dataset.miclalt, event.target.textContent];
|
|
45
|
+
}
|
|
41
46
|
}
|
|
42
47
|
};
|
|
43
48
|
|
|
@@ -43,11 +43,11 @@
|
|
|
43
43
|
interpolate-size: allow-keywords;
|
|
44
44
|
|
|
45
45
|
&[tabindex='0']:not(.micl-card--disabled) {
|
|
46
|
-
--
|
|
46
|
+
--micl-ripple: 1;
|
|
47
47
|
--statelayer-color: var(--md-sys-color-on-surface);
|
|
48
48
|
|
|
49
49
|
background-image:
|
|
50
|
-
radial-gradient(circle at var(--x, center) var(--y, center), transparent 0%, rgb(from var(--statelayer-color) r g b / var(--statelayer-opacity)) 10%, transparent 10%),
|
|
50
|
+
radial-gradient(circle at var(--micl-x, center) var(--micl-y, center), transparent 0%, rgb(from var(--statelayer-color) r g b / var(--statelayer-opacity)) 10%, transparent 10%),
|
|
51
51
|
linear-gradient(rgb(from var(--statelayer-color) r g b / var(--statelayer-opacity)));
|
|
52
52
|
background-repeat: no-repeat;
|
|
53
53
|
background-size: 10000%, 100%;
|
|
@@ -7,10 +7,10 @@ This component implements the the [Material Design 3 Expressive Dialog](https://
|
|
|
7
7
|
To create a basic dialog, use the `<dialog>` element with the `micl-dialog` class. You can open and close the dialog using JavaScript, or you can use a control element, such as a button, to open and close the dialog.
|
|
8
8
|
|
|
9
9
|
```HTML
|
|
10
|
-
<dialog id="mydialog" class="micl-dialog" closedby="any" popover>
|
|
10
|
+
<dialog id="mydialog" class="micl-dialog" closedby="any" popover aria-labelledby="mytitle" aria-describedby="mydesc">
|
|
11
11
|
<div class="micl-dialog__headline">
|
|
12
|
-
<h2>Basic dialog</h2>
|
|
13
|
-
<span class="micl-dialog__supporting-text">An example of a basic dialog</span>
|
|
12
|
+
<h2 id="mytitle">Basic dialog</h2>
|
|
13
|
+
<span id="mydesc" class="micl-dialog__supporting-text">An example of a basic dialog</span>
|
|
14
14
|
</div>
|
|
15
15
|
</dialog>
|
|
16
16
|
|
|
@@ -40,11 +40,11 @@ When dialogs with the `popover` attribute are opened, they animate from the cont
|
|
|
40
40
|
Removing the `popover` attribute creates a more intrusive **modal** dialog. This type of dialog requires the user to interact with its buttons or press the <kbd>Esc</kbd> key to close it.
|
|
41
41
|
|
|
42
42
|
```HTML
|
|
43
|
-
<dialog id="mydialog" class="micl-dialog" closedby="closerequest">
|
|
43
|
+
<dialog id="mydialog" class="micl-dialog" closedby="closerequest" aria-labelledby="mytitle" aria-describedby="mydesc">
|
|
44
44
|
<div class="micl-dialog__headline">
|
|
45
45
|
<span class="micl-dialog__icon material-symbols-outlined" aria-hidden="true">info</span>
|
|
46
|
-
<h2>Modal dialog</h2>
|
|
47
|
-
<span class="micl-dialog__supporting-text">An example of a modal dialog</span>
|
|
46
|
+
<h2 id="mytitle">Modal dialog</h2>
|
|
47
|
+
<span id="mydesc" class="micl-dialog__supporting-text">An example of a modal dialog</span>
|
|
48
48
|
</div>
|
|
49
49
|
<div class="micl-dialog__actions">
|
|
50
50
|
<form method="dialog">
|
|
@@ -90,15 +90,15 @@ A dialog typically consists of three main sections to organize its content:
|
|
|
90
90
|
A full-screen dialog covers the entire viewport, primarily on smaller screens. On screens wider than 560 pixels, a full-screen dialog behaves like a basic dialog. Use the `micl-dialog-fullscreen` class for this variant:
|
|
91
91
|
|
|
92
92
|
```HTML
|
|
93
|
-
<dialog id="mydialog" class="micl-dialog-fullscreen" closedby="none" popover>
|
|
93
|
+
<dialog id="mydialog" class="micl-dialog-fullscreen" closedby="none" popover aria-labelledby="mytitle" aria-describedby="mydesc">
|
|
94
94
|
<form method="dialog" class="micl-dialog__headline">
|
|
95
95
|
<button type="button" class="micl-iconbutton-s material-symbols-outlined" popovertarget="mydialog" aria-label="Close">close</button>
|
|
96
96
|
<span class="micl-dialog__icon material-symbols-outlined" aria-hidden="true">person</span>
|
|
97
|
-
<h2>Full-screen dialog</h2>
|
|
97
|
+
<h2 id="mytitle">Full-screen dialog</h2>
|
|
98
98
|
<button class="micl-button" value="dosave">Save</button>
|
|
99
99
|
</form>
|
|
100
100
|
<div class="micl-dialog__content">
|
|
101
|
-
<span class="micl-dialog__supporting-text">This dialog covers the whole screen.</span>
|
|
101
|
+
<span id="mydesc" class="micl-dialog__supporting-text">This dialog covers the whole screen.</span>
|
|
102
102
|
</div>
|
|
103
103
|
<form method="dialog" class="micl-dialog__actions">
|
|
104
104
|
<button type="button" class="micl-button" popovertarget="mydialog">Cancel</button>
|
|
@@ -47,14 +47,14 @@ button.micl-iconbutton-outlined-xl {
|
|
|
47
47
|
--md-sys-iconbutton-motion-effects: #{motion.$md-sys-motion-expressive-fast-spatial};
|
|
48
48
|
--md-sys-iconbutton-motion-duration: #{motion.$md-sys-motion-expressive-fast-spatial-duration};
|
|
49
49
|
--md-sys-iconbutton-motion-duration-reverse: #{motion.$md-sys-motion-expressive-fast-spatial-duration};
|
|
50
|
-
--
|
|
50
|
+
--micl-ripple: 1;
|
|
51
51
|
|
|
52
52
|
padding: 0;
|
|
53
53
|
border: none;
|
|
54
54
|
border-radius: var(--md-sys-shape-corner-full);
|
|
55
55
|
background-color: transparent;
|
|
56
56
|
background-image:
|
|
57
|
-
radial-gradient(circle at var(--x, center) var(--y, center), transparent 0%, rgb(from var(--statelayer-color) r g b / var(--statelayer-opacity)) 10%, transparent 10%),
|
|
57
|
+
radial-gradient(circle at var(--micl-x, center) var(--micl-y, center), transparent 0%, rgb(from var(--statelayer-color) r g b / var(--statelayer-opacity)) 10%, transparent 10%),
|
|
58
58
|
linear-gradient(rgb(from var(--statelayer-color) r g b / var(--statelayer-opacity)));
|
|
59
59
|
background-repeat: no-repeat;
|
|
60
60
|
background-size: 10000%, 100%;
|
|
@@ -37,7 +37,12 @@ export default (() =>
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
if (event.target.classList.contains('micl-button--toggle')) {
|
|
40
|
+
event.target.classList.add('micl-button--toggled');
|
|
40
41
|
event.target.classList.toggle('micl-button--selected');
|
|
42
|
+
if (!!event.target.dataset.miclalt) {
|
|
43
|
+
[event.target.textContent, event.target.dataset.miclalt] =
|
|
44
|
+
[event.target.dataset.miclalt, event.target.textContent];
|
|
45
|
+
}
|
|
41
46
|
}
|
|
42
47
|
};
|
|
43
48
|
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
border-radius: var(--md-sys-shape-corner-none);
|
|
108
108
|
background-color: var(--md-sys-list-item-container-color);
|
|
109
109
|
background-image:
|
|
110
|
-
radial-gradient(circle at var(--x, center) var(--y, center), transparent 0%, rgb(from var(--statelayer-color) r g b / var(--statelayer-opacity)) 10%, transparent 10%),
|
|
110
|
+
radial-gradient(circle at var(--micl-x, center) var(--micl-y, center), transparent 0%, rgb(from var(--statelayer-color) r g b / var(--statelayer-opacity)) 10%, transparent 10%),
|
|
111
111
|
linear-gradient(rgb(from var(--statelayer-color) r g b / var(--statelayer-opacity)));
|
|
112
112
|
background-repeat: no-repeat;
|
|
113
113
|
background-size: 10000%, 100%;
|
|
@@ -117,7 +117,7 @@
|
|
|
117
117
|
--statelayer-opacity var(--md-sys-list-motion-duration) linear;
|
|
118
118
|
|
|
119
119
|
&:not(:has(> button)) {
|
|
120
|
-
--
|
|
120
|
+
--micl-ripple: 1;
|
|
121
121
|
}
|
|
122
122
|
&> a,
|
|
123
123
|
&> button,
|
|
@@ -1,98 +1,149 @@
|
|
|
1
|
-
#
|
|
2
|
-
This component implements the the [Material Design 3 Expressive
|
|
1
|
+
# Navigation rail
|
|
2
|
+
This component implements the the [Material Design 3 Expressive Navigation rail](https://m3.material.io/components/navigation-rail/overview) design.
|
|
3
3
|
|
|
4
4
|
## Basic Usage
|
|
5
5
|
|
|
6
6
|
### HTML
|
|
7
|
-
To create a
|
|
7
|
+
To create a simple navigation rail, use a `<div>` element with the `micl-navigationrail` class. Inside, use an `input type="radio"` group to create the selectable navigation items. The `input` elements must share the same `name` attribute to ensure that only one item can be selected at a time. The `label` elements are associated with their respective inputs using the `for` attribute.
|
|
8
8
|
|
|
9
9
|
```HTML
|
|
10
|
-
<
|
|
11
|
-
<div class="micl-
|
|
12
|
-
<
|
|
13
|
-
<
|
|
14
|
-
|
|
15
|
-
class="micl-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
>
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
10
|
+
<div id="mynavigationrail" class="micl-navigationrail">
|
|
11
|
+
<div class="micl-navigationrail__content">
|
|
12
|
+
<input type="radio" id="item1" name="navitem" value="email_inbox" checked>
|
|
13
|
+
<label for="item1" class="micl-navigationrail__item" tabindex="0">
|
|
14
|
+
<span class="micl-navigationrail__icon material-symbols-outlined" aria-hidden="true">inbox</span>
|
|
15
|
+
<span class="micl-navigationrail__text">Inbox</span>
|
|
16
|
+
</label>
|
|
17
|
+
<input type="radio" id="item2" name="navitem" value="email_outbox">
|
|
18
|
+
<label for="item2" class="micl-navigationrail__item" tabindex="0">
|
|
19
|
+
<span class="micl-navigationrail__icon material-symbols-outlined" aria-hidden="true">outbox</span>
|
|
20
|
+
<span class="micl-navigationrail__text">Outbox</span>
|
|
21
|
+
</label>
|
|
22
22
|
</div>
|
|
23
|
-
</
|
|
23
|
+
</div>
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
### CSS
|
|
27
|
-
Import the
|
|
27
|
+
Import the navigation rail styles into your project:
|
|
28
28
|
|
|
29
29
|
```CSS
|
|
30
|
-
@use "material-inspired-component-library/dist/
|
|
30
|
+
@use "material-inspired-component-library/dist/navigationrail";
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
### JavaScript
|
|
34
|
-
|
|
34
|
+
This component requires JavaScript to support keyboard navigation. The library will automatically initialize new components as they're added to the DOM.
|
|
35
|
+
|
|
36
|
+
```JavaScript
|
|
37
|
+
import micl from "material-inspired-component-library/dist/micl";
|
|
38
|
+
```
|
|
35
39
|
|
|
36
40
|
### Demo
|
|
37
|
-
A live example of the [
|
|
41
|
+
A live example of the [Navigation rail component](https://henkpb.github.io/micl/navigationrail.html) is available for you to interact with.
|
|
38
42
|
|
|
39
43
|
## Variants
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
To create a modal side sheet, use the `<dialog>` element without the `popover` attribute. Use `closedby="closerequest"` to prevent the side sheet from being dismissed by clicking outside of it. You'll also need a button or other control with popovertarget to close it.
|
|
44
|
+
The basic example creates a **collapsed** navigation rail. Add a menu button to allow the user to toggle between a **collapsed** and an **expanded** view.
|
|
43
45
|
|
|
44
46
|
```HTML
|
|
45
|
-
<
|
|
46
|
-
<div class="micl-
|
|
47
|
+
<div id="mynavigationrail" class="micl-navigationrail">
|
|
48
|
+
<div class="micl-navigationrail__headline">
|
|
47
49
|
<button
|
|
48
50
|
type="button"
|
|
49
|
-
class="micl-iconbutton-s material-symbols-outlined"
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
class="micl-iconbutton-standard-s micl-button--toggle material-symbols-outlined"
|
|
52
|
+
data-miclalt="menu_open"
|
|
53
|
+
aria-label="Toggle navigation rail"
|
|
54
|
+
>menu</button>
|
|
55
|
+
</div>
|
|
56
|
+
<div class="micl-navigationrail__content">
|
|
57
|
+
...
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
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.
|
|
63
|
+
|
|
64
|
+
### Popover expanded navigation rail
|
|
65
|
+
|
|
66
|
+
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.
|
|
67
|
+
|
|
68
|
+
```HTML
|
|
69
|
+
<div id="mynavigationrail" class="micl-navigationrail" popover="manual">
|
|
70
|
+
<div class="micl-navigationrail__headline">
|
|
53
71
|
<button
|
|
54
72
|
type="button"
|
|
55
|
-
class="micl-iconbutton-s material-symbols-outlined"
|
|
56
|
-
popovertarget="
|
|
57
|
-
|
|
58
|
-
|
|
73
|
+
class="micl-iconbutton-standard-s micl-button--toggle material-symbols-outlined"
|
|
74
|
+
popovertarget="mynavigationrail"
|
|
75
|
+
data-miclalt="menu_open"
|
|
76
|
+
aria-label="Toggle navigation rail"
|
|
77
|
+
>menu</button>
|
|
59
78
|
</div>
|
|
60
|
-
<div class="micl-
|
|
61
|
-
...
|
|
79
|
+
<div class="micl-navigationrail__content">
|
|
80
|
+
...
|
|
62
81
|
</div>
|
|
63
|
-
|
|
64
|
-
<button type="button" class="micl-button">Save</button>
|
|
65
|
-
</div>
|
|
66
|
-
</dialog>
|
|
82
|
+
</div>
|
|
67
83
|
```
|
|
68
84
|
|
|
69
|
-
|
|
85
|
+
> [!WARNING]
|
|
86
|
+
> The **popover** navigation rail component adds CSS rules to the `<body>` element 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:
|
|
87
|
+
>
|
|
88
|
+
> ```CSS
|
|
89
|
+
> margin-inline-start: var(--md-sys-navigationrail-collapsed-width);
|
|
90
|
+
> ```
|
|
91
|
+
|
|
92
|
+
### Modal navigation rail
|
|
93
|
+
|
|
94
|
+
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 `<div>`.
|
|
95
|
+
|
|
70
96
|
```HTML
|
|
71
|
-
<
|
|
72
|
-
|
|
97
|
+
<dialog id="mynavigationrail" class="micl-navigationrail" closedby="closerequest">
|
|
98
|
+
<div class="micl-navigationrail__headline">
|
|
99
|
+
<button
|
|
100
|
+
type="button"
|
|
101
|
+
class="micl-iconbutton-standard-s micl-button--toggle material-symbols-outlined"
|
|
102
|
+
popovertarget="mynavigationrail"
|
|
103
|
+
data-miclalt="menu_open"
|
|
104
|
+
aria-label="Toggle navigation rail"
|
|
105
|
+
>menu</button>
|
|
106
|
+
</div>
|
|
107
|
+
<div class="micl-navigationrail__content">
|
|
108
|
+
...
|
|
109
|
+
</div>
|
|
110
|
+
</dialog>
|
|
73
111
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
112
|
+
<button
|
|
113
|
+
type="button"
|
|
114
|
+
class="micl-iconbutton-standard-s micl-button--toggle material-symbols-outlined"
|
|
115
|
+
popovertarget="mynavigationrail"
|
|
116
|
+
aria-label="Toggle navigation rail"
|
|
117
|
+
>menu</button>
|
|
79
118
|
```
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
119
|
+
|
|
120
|
+
The button inside the navigation rail is used to hide the navigation rail, while the button outside is responsible for opening it.
|
|
121
|
+
|
|
122
|
+
## Customizations
|
|
123
|
+
You can customize the appearance of the Navigation rail component by overriding its global CSS variables. These variables are declared on the `:root` pseudo-class and can be changed on any appropriate parent element to affect its child navigation rails.
|
|
124
|
+
|
|
125
|
+
| Variable name | Default Value | Description |
|
|
126
|
+
| ------------- | ------------- | ----------- |
|
|
127
|
+
| --md-sys-navigationrail-collapsed-width | 96px | The width of the collapsed navigation rail |
|
|
128
|
+
| --md-sys-navigationrail-expanded-maxwidth | 360px | The largest allowed width of the expanded navigation rail |
|
|
129
|
+
| --md-sys-navigationrail-expanded-minwidth | 220px | The smallest allowed width of the expanded navigation rail |
|
|
130
|
+
|
|
131
|
+
**Example: Changing the width of the collapsed navigation rail**
|
|
132
|
+
|
|
133
|
+
```HTML
|
|
134
|
+
<div style="--md-sys-navigationrail-collapsed-width:80px">
|
|
135
|
+
<div id="mynavigationrail" class="micl-navigationrail">
|
|
136
|
+
...
|
|
137
|
+
</div>
|
|
138
|
+
</div>
|
|
85
139
|
```
|
|
86
140
|
|
|
87
|
-
|
|
88
|
-
The **standard** side sheet component adds CSS rules to the `<body>` element to properly resize the main content area when the side sheet is open. Overriding these rules may cause the component to behave unexpectedly. The rules that are applied are:
|
|
141
|
+
To add a vertical divider of the to the navigation rail, assign one to the following CSS variable:
|
|
89
142
|
|
|
90
143
|
```CSS
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
max-width: ...varies depending on if the side sheet is opened...
|
|
95
|
-
transition: ...transition on max-width...
|
|
144
|
+
#mynavigationrail {
|
|
145
|
+
--md-sys-divider-thickness: 1;
|
|
146
|
+
}
|
|
96
147
|
```
|
|
97
148
|
|
|
98
149
|
## Compatibility
|