material-inspired-component-library 8.1.0 → 9.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 +106 -18
- package/components/README.md +1 -1
- package/components/accordion/README.md +6 -6
- package/components/alert/README.md +10 -10
- package/components/alert/index.scss +27 -52
- package/components/appbar/README.md +19 -6
- package/components/appbar/index.scss +40 -44
- package/components/badge/README.md +12 -10
- package/components/badge/index.scss +21 -25
- package/components/bottomsheet/README.md +26 -1
- package/components/bottomsheet/index.scss +58 -44
- package/components/button/README.md +70 -10
- package/components/button/_shared.scss +210 -0
- package/components/button/index.scss +75 -389
- package/components/card/README.md +97 -85
- package/components/card/index.scss +46 -65
- package/components/checkbox/README.md +25 -14
- package/{tools/shapes/check.mjs → components/checkbox/_label.scss} +37 -42
- package/components/checkbox/index.scss +66 -66
- package/components/chip/README.md +186 -0
- package/components/chip/index.scss +285 -0
- package/components/datepicker/README.md +79 -0
- package/components/datepicker/index.scss +346 -315
- package/components/dialog/README.md +20 -10
- package/components/dialog/index.scss +55 -66
- package/components/divider/README.md +16 -15
- package/components/divider/index.scss +9 -25
- package/components/iconbutton/README.md +63 -12
- package/components/iconbutton/index.scss +142 -303
- package/components/list/README.md +89 -156
- package/components/list/index.scss +34 -36
- package/components/menu/README.md +81 -155
- package/components/menu/index.scss +52 -58
- package/components/navigationbar/README.md +108 -0
- package/components/navigationbar/index.scss +185 -0
- package/components/navigationrail/README.md +62 -37
- package/components/navigationrail/_navitem.scss +96 -0
- package/components/navigationrail/index.scss +78 -132
- package/components/progressindicator/README.md +83 -47
- package/components/progressindicator/index.scss +622 -172
- package/components/radio/README.md +11 -9
- package/components/radio/index.scss +36 -33
- package/components/select/README.md +12 -7
- package/components/select/index.scss +26 -34
- package/components/shapes/README.md +3 -3
- package/components/shapes/index.scss +0 -1
- package/components/sidesheet/README.md +21 -9
- package/components/sidesheet/index.scss +38 -46
- package/components/slider/README.md +21 -0
- package/components/slider/index.scss +108 -139
- package/components/snackbar/README.md +32 -35
- package/components/snackbar/index.scss +10 -22
- package/components/stepper/README.md +14 -7
- package/components/stepper/index.scss +58 -39
- package/components/switch/README.md +22 -15
- package/components/switch/index.scss +68 -60
- package/components/textfield/README.md +48 -5
- package/components/textfield/index.scss +192 -248
- package/components/timepicker/README.md +53 -23
- package/components/timepicker/index.scss +110 -128
- package/dist/alert.css +1 -1
- package/dist/alert.js +1 -1
- package/dist/appbar.css +1 -1
- package/dist/appbar.js +1 -1
- package/dist/badge.css +1 -1
- package/dist/badge.js +1 -1
- package/dist/base.css +1 -0
- package/dist/base.js +1 -0
- package/dist/bottomsheet.css +1 -1
- package/dist/bottomsheet.js +1 -1
- package/dist/button.css +1 -1
- package/dist/button.js +1 -1
- package/dist/card.css +1 -1
- package/dist/card.js +1 -1
- package/dist/checkbox.css +1 -1
- package/dist/checkbox.js +1 -1
- package/dist/chip.css +1 -0
- package/dist/chip.js +1 -0
- package/dist/components/button/index.d.ts +1 -1
- package/dist/components/iconbutton/index.d.ts +2 -7
- package/dist/components/slider/index.d.ts +1 -1
- package/dist/components/textfield/index.d.ts +2 -2
- package/dist/datepicker.css +1 -1
- package/dist/datepicker.js +1 -1
- package/dist/dialog.css +1 -1
- package/dist/dialog.js +1 -1
- package/dist/divider.css +1 -1
- package/dist/divider.js +1 -1
- package/dist/field.css +1 -0
- package/dist/field.js +1 -0
- package/dist/foundations/form/index.js +1 -1
- package/dist/foundations/runtime.d.ts +15 -0
- package/dist/foundations/runtime.js +1 -0
- package/dist/iconbutton.css +1 -1
- package/dist/iconbutton.js +1 -1
- package/dist/layout.css +1 -1
- package/dist/layout.js +1 -1
- package/dist/list.css +1 -1
- package/dist/list.js +1 -1
- package/dist/menu.css +1 -1
- package/dist/menu.js +1 -1
- package/dist/micl.css +1 -1
- package/dist/micl.d.ts +14 -5
- package/dist/micl.js +1 -1
- package/dist/navigationbar.css +1 -0
- package/dist/navigationbar.js +1 -0
- package/dist/navigationrail.css +1 -1
- package/dist/navigationrail.js +1 -1
- package/dist/progressindicator.css +1 -1
- package/dist/progressindicator.js +1 -1
- package/dist/radio.css +1 -1
- package/dist/radio.js +1 -1
- package/dist/scrollbar.js +1 -1
- package/dist/select.css +1 -1
- package/dist/select.js +1 -1
- package/dist/shapes.css +1 -1
- package/dist/shapes.js +1 -1
- package/dist/sidesheet.css +1 -1
- package/dist/sidesheet.js +1 -1
- package/dist/slider.css +1 -1
- package/dist/slider.js +1 -1
- package/dist/snackbar.css +1 -1
- package/dist/snackbar.js +1 -1
- package/dist/stepper.css +1 -1
- package/dist/stepper.js +1 -1
- package/dist/switch.css +1 -1
- package/dist/switch.js +1 -1
- package/dist/textfield.css +1 -1
- package/dist/textfield.js +1 -1
- package/dist/timepicker.css +1 -1
- package/dist/timepicker.js +1 -1
- package/foundations/_index.scss +35 -0
- package/foundations/{index.scss → base/index.scss} +21 -56
- package/foundations/field/index.scss +37 -0
- package/foundations/layout/index.scss +64 -65
- package/package.json +23 -9
- package/styles/statelayer.scss +20 -5
- package/styles.scss +5 -2
- package/.claude/settings.local.json +0 -14
- package/.editorconfig +0 -12
- package/.gitattributes +0 -9
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -35
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
- package/CLAUDE.md +0 -53
- package/CODE_OF_CONDUCT.md +0 -128
- package/components/bottomsheet/index.ts +0 -153
- package/components/button/index.ts +0 -79
- package/components/checkbox/index.ts +0 -148
- package/components/datepicker/index.ts +0 -693
- package/components/iconbutton/index.ts +0 -77
- package/components/list/index.ts +0 -138
- package/components/menu/index.ts +0 -145
- package/components/navigationrail/index.ts +0 -87
- package/components/progressindicator/index.ts +0 -77
- package/components/slider/index.ts +0 -149
- package/components/snackbar/index.ts +0 -118
- package/components/stepper/index.ts +0 -248
- package/components/textfield/index.ts +0 -188
- package/components/timepicker/index.ts +0 -413
- package/dist/components/progressindicator/index.d.ts +0 -6
- package/dist/foundations.css +0 -1
- package/dist/foundations.js +0 -1
- package/docs/accordion.html +0 -344
- package/docs/alert.html +0 -177
- package/docs/bottomsheet.html +0 -240
- package/docs/button.html +0 -290
- package/docs/card-awards.webp +0 -0
- package/docs/card-cabinet.webp +0 -0
- package/docs/card-city.webp +0 -0
- package/docs/card-fingerprint.webp +0 -0
- package/docs/card-holiday.webp +0 -0
- package/docs/card-names.webp +0 -0
- package/docs/card.html +0 -159
- package/docs/checkbox.html +0 -147
- package/docs/datepicker.html +0 -274
- package/docs/dialog.html +0 -195
- package/docs/divider.html +0 -139
- package/docs/docs.css +0 -26
- package/docs/docs.js +0 -139
- package/docs/iconbutton.html +0 -329
- package/docs/index.html +0 -431
- package/docs/list.html +0 -310
- package/docs/menu.html +0 -574
- package/docs/micl.css +0 -1
- package/docs/micl.js +0 -1
- package/docs/navigationrail.html +0 -138
- package/docs/progressindicator.html +0 -288
- package/docs/radio.html +0 -123
- package/docs/select.html +0 -337
- package/docs/shapes.css +0 -1
- package/docs/shapes.html +0 -159
- package/docs/shapes.js +0 -1
- package/docs/sidesheet.html +0 -149
- package/docs/slider.html +0 -141
- package/docs/snackbar.html +0 -102
- package/docs/stepper.html +0 -319
- package/docs/switch.html +0 -196
- package/docs/textfield.html +0 -208
- package/docs/themes/airblue/dark-hc.css +0 -51
- package/docs/themes/airblue/dark-mc.css +0 -51
- package/docs/themes/airblue/dark.css +0 -51
- package/docs/themes/airblue/light-hc.css +0 -51
- package/docs/themes/airblue/light-mc.css +0 -51
- package/docs/themes/airblue/light.css +0 -51
- package/docs/themes/airblue/theme.css +0 -306
- package/docs/themes/barnred/dark-hc.css +0 -51
- package/docs/themes/barnred/dark-mc.css +0 -51
- package/docs/themes/barnred/dark.css +0 -51
- package/docs/themes/barnred/light-hc.css +0 -51
- package/docs/themes/barnred/light-mc.css +0 -51
- package/docs/themes/barnred/light.css +0 -51
- package/docs/themes/barnred/theme.css +0 -306
- package/docs/themes/citrine/dark-hc.css +0 -51
- package/docs/themes/citrine/dark-mc.css +0 -51
- package/docs/themes/citrine/dark.css +0 -51
- package/docs/themes/citrine/light-hc.css +0 -51
- package/docs/themes/citrine/light-mc.css +0 -51
- package/docs/themes/citrine/light.css +0 -51
- package/docs/themes/citrine/theme.css +0 -306
- package/docs/themes/gray/dark-hc.css +0 -51
- package/docs/themes/gray/dark-mc.css +0 -51
- package/docs/themes/gray/dark.css +0 -51
- package/docs/themes/gray/light-hc.css +0 -51
- package/docs/themes/gray/light-mc.css +0 -51
- package/docs/themes/gray/light.css +0 -51
- package/docs/themes/gray/theme.css +0 -306
- package/docs/themes/greenery/dark-hc.css +0 -51
- package/docs/themes/greenery/dark-mc.css +0 -51
- package/docs/themes/greenery/dark.css +0 -51
- package/docs/themes/greenery/light-hc.css +0 -51
- package/docs/themes/greenery/light-mc.css +0 -51
- package/docs/themes/greenery/light.css +0 -51
- package/docs/themes/greenery/theme.css +0 -306
- package/docs/themes/hermana/dark-hc.css +0 -51
- package/docs/themes/hermana/dark-mc.css +0 -51
- package/docs/themes/hermana/dark.css +0 -51
- package/docs/themes/hermana/light-hc.css +0 -51
- package/docs/themes/hermana/light-mc.css +0 -51
- package/docs/themes/hermana/light.css +0 -51
- package/docs/themes/hermana/theme.css +0 -306
- package/docs/themes/illuminating/dark-hc.css +0 -51
- package/docs/themes/illuminating/dark-mc.css +0 -51
- package/docs/themes/illuminating/dark.css +0 -51
- package/docs/themes/illuminating/light-hc.css +0 -51
- package/docs/themes/illuminating/light-mc.css +0 -51
- package/docs/themes/illuminating/light.css +0 -51
- package/docs/themes/illuminating/theme.css +0 -306
- package/docs/themes/magenta/dark-hc.css +0 -51
- package/docs/themes/magenta/dark-mc.css +0 -51
- package/docs/themes/magenta/dark.css +0 -51
- package/docs/themes/magenta/light-hc.css +0 -51
- package/docs/themes/magenta/light-mc.css +0 -51
- package/docs/themes/magenta/light.css +0 -51
- package/docs/themes/magenta/theme.css +0 -306
- package/docs/themes/mocha/dark-hc.css +0 -51
- package/docs/themes/mocha/dark-mc.css +0 -51
- package/docs/themes/mocha/dark.css +0 -51
- package/docs/themes/mocha/light-hc.css +0 -51
- package/docs/themes/mocha/light-mc.css +0 -51
- package/docs/themes/mocha/light.css +0 -51
- package/docs/themes/mocha/theme.css +0 -306
- package/docs/themes/olivegreen/dark-hc.css +0 -51
- package/docs/themes/olivegreen/dark-mc.css +0 -51
- package/docs/themes/olivegreen/dark.css +0 -51
- package/docs/themes/olivegreen/light-hc.css +0 -51
- package/docs/themes/olivegreen/light-mc.css +0 -51
- package/docs/themes/olivegreen/light.css +0 -51
- package/docs/themes/olivegreen/theme.css +0 -306
- package/docs/themes/peri/dark-hc.css +0 -51
- package/docs/themes/peri/dark-mc.css +0 -51
- package/docs/themes/peri/dark.css +0 -51
- package/docs/themes/peri/light-hc.css +0 -51
- package/docs/themes/peri/light-mc.css +0 -51
- package/docs/themes/peri/light.css +0 -51
- package/docs/themes/peri/theme.css +0 -306
- package/docs/timepicker.html +0 -160
- package/foundations/form/index.ts +0 -174
- package/foundations/layout/README.md +0 -127
- package/intl.d.ts +0 -9
- package/micl.ts +0 -221
- package/styles/README.md +0 -196
- package/tools/shapes/generate.mjs +0 -828
- package/tsconfig.json +0 -116
- package/webpack.config.js +0 -104
|
@@ -41,6 +41,7 @@ This component requires JavaScript for functionality:
|
|
|
41
41
|
```JavaScript
|
|
42
42
|
import micl from "material-inspired-component-library/dist/micl";
|
|
43
43
|
```
|
|
44
|
+
When loading individual JavaScript files, also load `dist/list` — it provides the keyboard navigation of the menu items.
|
|
44
45
|
|
|
45
46
|
This will initialize any Menu component, including those that will be added to the DOM later on.
|
|
46
47
|
|
|
@@ -176,161 +177,86 @@ Menu items can be grouped by including a [Divider component](../divider/README.m
|
|
|
176
177
|
|
|
177
178
|
You may include an `<li>` with the `micl-menu__section` class to give the menu item group a descriptive title.
|
|
178
179
|
|
|
179
|
-
##
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
|
190
|
-
|
|
|
191
|
-
|
|
|
192
|
-
|
|
|
193
|
-
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
|
198
|
-
|
|
199
|
-
|
|
|
200
|
-
|
|
|
201
|
-
|
|
|
202
|
-
|
|
|
203
|
-
|
|
|
204
|
-
|
|
|
205
|
-
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
|
210
|
-
|
|
211
|
-
|
|
|
212
|
-
|
|
|
213
|
-
|
|
|
214
|
-
|
|
|
215
|
-
|
|
|
216
|
-
|
|
|
217
|
-
|
|
|
218
|
-
|
|
|
219
|
-
|
|
|
220
|
-
|
|
|
221
|
-
|
|
|
222
|
-
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
|
243
|
-
|
|
244
|
-
|
|
|
245
|
-
|
|
|
246
|
-
|
|
|
247
|
-
|
|
|
248
|
-
| --md-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
|
253
|
-
|
|
254
|
-
|
|
|
255
|
-
|
|
|
256
|
-
|
|
|
257
|
-
|
|
|
258
|
-
|
|
|
259
|
-
| --md-comp-menu-vibrant-menu-item-hovered-trailing-icon-color |
|
|
260
|
-
| --md-comp-menu-vibrant-menu-item-hovered-trailing-supporting-text-color |
|
|
261
|
-
| --md-comp-menu-vibrant-menu-item-pressed-label-text-color |
|
|
262
|
-
| --md-comp-menu-vibrant-menu-item-pressed-leading-icon-color |
|
|
263
|
-
| --md-comp-menu-vibrant-menu-item-pressed-state-layer-color |
|
|
264
|
-
| --md-comp-menu-vibrant-menu-item-pressed-state-layer-opacity |
|
|
265
|
-
| --md-comp-menu-vibrant-menu-item-pressed-supporting-text-color |
|
|
266
|
-
| --md-comp-menu-vibrant-menu-item-pressed-trailing-icon-color |
|
|
267
|
-
| --md-comp-menu-vibrant-menu-item-pressed-trailing-supporting-text-color |
|
|
268
|
-
| --md-comp-menu-vibrant-menu-item-label-text-color |
|
|
269
|
-
| --md-comp-menu-vibrant-menu-item-leading-icon-color |
|
|
270
|
-
| --md-comp-menu-vibrant-menu-item-supporting-text-color |
|
|
271
|
-
| --md-comp-menu-vibrant-menu-item-trailing-icon-color |
|
|
272
|
-
| --md-comp-menu-vibrant-menu-item-trailing-supporting-text-color |
|
|
273
|
-
| --md-comp-menu-vibrant-section-label-text-color |
|
|
274
|
-
| |
|
|
275
|
-
| --md-comp-menu-standard-menu-item-selected-container-color |
|
|
276
|
-
| --md-comp-menu-standard-menu-item-selected-label-text-color |
|
|
277
|
-
| --md-comp-menu-standard-menu-item-selected-leading-icon-color |
|
|
278
|
-
| --md-comp-menu-standard-menu-item-selected-supporting-text-color |
|
|
279
|
-
| --md-comp-menu-standard-menu-item-selected-trailing-icon-color |
|
|
280
|
-
| --md-comp-menu-standard-menu-item-selected-trailing-supporting-text-color |
|
|
281
|
-
| |
|
|
282
|
-
| --md-comp-menu-standard-menu-item-selected-disabled-container-color |
|
|
283
|
-
| --md-comp-menu-standard-menu-item-selected-disabled-container-opacity |
|
|
284
|
-
| --md-comp-menu-standard-menu-item-selected-disabled-label-text-color |
|
|
285
|
-
| --md-comp-menu-standard-menu-item-selected-disabled-label-text-opacity |
|
|
286
|
-
| --md-comp-menu-standard-menu-item-selected-disabled-leading-icon-color |
|
|
287
|
-
| --md-comp-menu-standard-menu-item-selected-disabled-leading-icon-opacity |
|
|
288
|
-
| --md-comp-menu-standard-menu-item-selected-disabled-trailing-icon-color |
|
|
289
|
-
| --md-comp-menu-standard-menu-item-selected-disabled-trailing-icon-opacity |
|
|
290
|
-
| --md-comp-menu-standard-menu-item-selected-disabled-trailing-supporting-text-color |
|
|
291
|
-
| --md-comp-menu-standard-menu-item-selected-focused-label-text-color |
|
|
292
|
-
| --md-comp-menu-standard-menu-item-selected-focused-leading-icon-color |
|
|
293
|
-
| --md-comp-menu-standard-menu-item-selected-focused-state-layer-color |
|
|
294
|
-
| --md-comp-menu-standard-menu-item-selected-focused-state-layer-opacity |
|
|
295
|
-
| --md-comp-menu-standard-menu-item-selected-focused-supporting-text-color |
|
|
296
|
-
| --md-comp-menu-standard-menu-item-selected-focused-trailing-icon-color |
|
|
297
|
-
| --md-comp-menu-standard-menu-item-selected-focused-trailing-supporting-text-color |
|
|
298
|
-
| --md-comp-menu-standard-menu-item-selected-hovered-label-text-color |
|
|
299
|
-
| --md-comp-menu-standard-menu-item-selected-hovered-leading-icon-color |
|
|
300
|
-
| --md-comp-menu-standard-menu-item-selected-hovered-state-layer-color |
|
|
301
|
-
| --md-comp-menu-standard-menu-item-selected-hovered-state-layer-opacity |
|
|
302
|
-
| --md-comp-menu-standard-menu-item-selected-hovered-supporting-text-color |
|
|
303
|
-
| --md-comp-menu-standard-menu-item-selected-hovered-trailing-icon-color |
|
|
304
|
-
| --md-comp-menu-standard-menu-item-selected-hovered-trailing-supporting-text-color |
|
|
305
|
-
| --md-comp-menu-standard-menu-item-selected-pressed-label-text-color |
|
|
306
|
-
| --md-comp-menu-standard-menu-item-selected-pressed-leading-icon-color |
|
|
307
|
-
| --md-comp-menu-standard-menu-item-selected-pressed-state-layer-color |
|
|
308
|
-
| --md-comp-menu-standard-menu-item-selected-pressed-state-layer-opacity |
|
|
309
|
-
| --md-comp-menu-standard-menu-item-selected-pressed-supporting-text-color |
|
|
310
|
-
| --md-comp-menu-standard-menu-item-selected-pressed-trailing-icon-color |
|
|
311
|
-
| --md-comp-menu-standard-menu-item-selected-pressed-trailing-supporting-text-color |
|
|
312
|
-
| |
|
|
313
|
-
| --md-comp-menu-vibrant-menu-item-selected-container-color |
|
|
314
|
-
| --md-comp-menu-vibrant-menu-item-selected-label-text-color |
|
|
315
|
-
| --md-comp-menu-vibrant-menu-item-selected-leading-icon-color |
|
|
316
|
-
| --md-comp-menu-vibrant-menu-item-selected-supporting-text-color |
|
|
317
|
-
| --md-comp-menu-vibrant-menu-item-selected-trailing-icon-color |
|
|
318
|
-
| --md-comp-menu-vibrant-menu-item-selected-trailing-supporting-text-color |
|
|
319
|
-
| |
|
|
320
|
-
| --md-comp-menu-vibrant-menu-item-selected-disabled-label-text-opacity |
|
|
321
|
-
| --md-comp-menu-vibrant-menu-item-selected-disabled-leading-icon-opacity |
|
|
322
|
-
| --md-comp-menu-vibrant-menu-item-selected-disabled-supporting-text-opacity |
|
|
323
|
-
| --md-comp-menu-vibrant-menu-item-selected-disabled-trailing-icon-opacity |
|
|
324
|
-
| --md-comp-menu-vibrant-menu-item-selected-disabled-trailing-supporting-text-opacity |
|
|
325
|
-
| --md-comp-menu-vibrant-menu-item-selected-focused-state-layer-color |
|
|
326
|
-
| --md-comp-menu-vibrant-menu-item-selected-focused-state-layer-opacity |
|
|
327
|
-
| --md-comp-menu-vibrant-menu-item-selected-focused-label-text-color |
|
|
328
|
-
| --md-comp-menu-vibrant-menu-item-selected-hovered-state-layer-color |
|
|
329
|
-
| --md-comp-menu-vibrant-menu-item-selected-hovered-state-layer-opacity |
|
|
330
|
-
| --md-comp-menu-vibrant-menu-item-selected-hovered-label-text-color |
|
|
331
|
-
| --md-comp-menu-vibrant-menu-item-selected-pressed-state-layer-color |
|
|
332
|
-
| --md-comp-menu-vibrant-menu-item-selected-pressed-state-layer-opacity |
|
|
333
|
-
| --md-comp-menu-vibrant-menu-item-selected-pressed-label-text-color |
|
|
180
|
+
## Theming
|
|
181
|
+
Each menu can be themed with CSS custom properties that follow the Material Design 3 component-token naming convention, as defined in the [Material Design 3 Expressive Menu Specification](https://m3.material.io/components/menus/specs). Set them on any appropriate parent element to affect its child menus.
|
|
182
|
+
|
|
183
|
+
### Container
|
|
184
|
+
|
|
185
|
+
| Custom property | Meaning | Default |
|
|
186
|
+
|---|---|---|
|
|
187
|
+
| `--md-comp-menu-width-min` | The minimum width of a menu | `112px` |
|
|
188
|
+
| `--md-comp-menu-width-max` | The maximum width of a menu | `320px` |
|
|
189
|
+
| `--md-comp-menu-container-elevation` | The shadow (elevation) of the menu surface | `--md-sys-elevation-level2` |
|
|
190
|
+
| `--md-comp-menu-container-shape` | The corner rounding of the menu surface | `--md-sys-shape-corner-large` |
|
|
191
|
+
| `--md-comp-menu-active-container-shape` | The corner rounding while the menu is the frontmost menu | `--md-comp-menu-container-shape` |
|
|
192
|
+
| `--md-comp-menu-inactive-container-shape` | The corner rounding while one of its submenus is open | `--md-sys-shape-corner-small` |
|
|
193
|
+
| `--md-comp-menu-standard-container-color` | The background color of a standard menu | `--md-sys-color-surface-container-low` |
|
|
194
|
+
| `--md-comp-menu-vibrant-container-color` | The background color of a vibrant menu | `--md-sys-color-tertiary-container` |
|
|
195
|
+
|
|
196
|
+
### Item groups and section labels
|
|
197
|
+
|
|
198
|
+
| Custom property | Meaning | Default |
|
|
199
|
+
|---|---|---|
|
|
200
|
+
| `--md-comp-menu-gap` | The gap between the item groups (the lists) of a menu | `2px` |
|
|
201
|
+
| `--md-comp-menu-group-padding` | The vertical padding inside an item group | `4px` |
|
|
202
|
+
| `--md-comp-menu-group-shape` | The corner rounding of the edges where two item groups meet | `--md-sys-shape-corner-small` |
|
|
203
|
+
| `--md-comp-menu-section-label-top-space` | The padding above a section label | `8px` |
|
|
204
|
+
| `--md-comp-menu-section-label-bottom-space` | The padding below a section label | `8px` |
|
|
205
|
+
| `--md-comp-menu-standard-section-label-text-color` | The text color of a section label in a standard menu | `--md-sys-color-on-surface-variant` |
|
|
206
|
+
| `--md-comp-menu-vibrant-section-label-text-color` | The text color of a section label in a vibrant menu | `--md-sys-color-on-tertiary-container` |
|
|
207
|
+
|
|
208
|
+
### Item layout
|
|
209
|
+
|
|
210
|
+
| Custom property | Meaning | Default |
|
|
211
|
+
|---|---|---|
|
|
212
|
+
| `--md-comp-menu-item-height` | The height of a menu item | `44px` |
|
|
213
|
+
| `--md-comp-menu-item-top-space` | The padding above the item content | `8px` |
|
|
214
|
+
| `--md-comp-menu-item-bottom-space` | The padding below the item content | `8px` |
|
|
215
|
+
| `--md-comp-menu-item-leading-space` | The padding before the item content | `16px` |
|
|
216
|
+
| `--md-comp-menu-item-trailing-space` | The padding after the item content | `16px` |
|
|
217
|
+
| `--md-comp-menu-item-leading-icon-size` | The size of a leading icon | `20px` |
|
|
218
|
+
| `--md-comp-menu-item-trailing-icon-size` | The size of a trailing icon | `20px` |
|
|
219
|
+
| `--md-comp-menu-item-shape` | The corner rounding of a menu item | `--md-sys-shape-corner-small` |
|
|
220
|
+
| `--md-comp-menu-item-selected-shape` | The corner rounding of a selected menu item | `--md-sys-shape-corner-large` |
|
|
221
|
+
| `--md-comp-menu-item-focus-indicator-color` | The color of the keyboard focus indicator | `--md-sys-color-secondary` |
|
|
222
|
+
| `--md-comp-menu-item-focus-indicator-thickness` | The thickness of the keyboard focus indicator | `3px` |
|
|
223
|
+
| `--md-comp-menu-item-focus-indicator-offset` | The offset of the keyboard focus indicator | `-3px` |
|
|
224
|
+
|
|
225
|
+
### Item colors
|
|
226
|
+
The colors of menu items follow a naming pattern that combines the menu variant, the item's selection and interaction state, and the colored part:
|
|
227
|
+
|
|
228
|
+
```
|
|
229
|
+
--md-comp-menu-<variant>-menu-item[-selected][-<state>]-<part>-color
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
- `<variant>` is `standard` or `vibrant`.
|
|
233
|
+
- `selected` targets items that are checked or contain a checked checkbox or switch.
|
|
234
|
+
- `<state>` is one of `hovered`, `focused`, `pressed` or `disabled`; omit it for the resting state.
|
|
235
|
+
- `<part>` is one of `container`, `label-text`, `leading-icon`, `supporting-text`, `trailing-icon`, `trailing-supporting-text` or `state-layer`.
|
|
236
|
+
|
|
237
|
+
Every `state-layer` color has an `-opacity` companion (defaults: hovered 8%, focused 10%, pressed 10%), and so does every color of a `disabled` state (default: --md-sys-state-disabled-state-layer-opacity, 38%). The `container` part exists for the resting, `selected` and `selected-disabled` combinations only. For example, `--md-comp-menu-standard-menu-item-selected-hovered-label-text-color` is the label color of a hovered selected item in a standard menu.
|
|
238
|
+
|
|
239
|
+
Inside a menu these tokens take precedence over the item color tokens of the [List component](../list/README.md). The defaults per part:
|
|
240
|
+
|
|
241
|
+
**Standard menu**
|
|
242
|
+
|
|
243
|
+
| Part | Resting | Hovered, focused, pressed | Selected (all states) | Disabled |
|
|
244
|
+
|---|---|---|---|---|
|
|
245
|
+
| container | `--md-sys-color-surface-container-low` | | `--md-sys-color-tertiary-container` | selected colors at `38%` |
|
|
246
|
+
| label-text | `--md-sys-color-on-surface-variant` | `--md-sys-color-on-surface` | `--md-sys-color-on-tertiary-container` | `--md-sys-color-on-surface` at `38%` |
|
|
247
|
+
| leading-icon, trailing-icon | `--md-sys-color-on-surface-variant` | `--md-sys-color-on-surface-variant` | `--md-sys-color-on-tertiary-container` | `--md-sys-color-on-surface` at `38%` |
|
|
248
|
+
| supporting-text, trailing-supporting-text | `--md-sys-color-on-surface-variant` | `--md-sys-color-on-surface-variant` | `--md-sys-color-on-tertiary-container | --md-sys-color-on-surface` at `38%` |
|
|
249
|
+
| state-layer | | --md-sys-color-on-surface | `--md-sys-color-on-tertiary-container` | |
|
|
250
|
+
|
|
251
|
+
**Vibrant menu**
|
|
252
|
+
|
|
253
|
+
| Part | Resting | Hovered, focused, pressed | Selected (all states) | Disabled |
|
|
254
|
+
|---|---|---|---|---|
|
|
255
|
+
| container | `--md-sys-color-tertiary-container` | | `--md-sys-color-tertiary` | selected colors at `38%` |
|
|
256
|
+
| label-text | `--md-sys-color-on-tertiary-container` | `--md-sys-color-on-tertiary-container` | `--md-sys-color-on-tertiary` | `--md-sys-color-on-tertiary-container` at `38%` |
|
|
257
|
+
| leading-icon, trailing-icon | `--md-sys-color-on-tertiary-container` | `--md-sys-color-tertiary` | `--md-sys-color-on-tertiary` | `--md-sys-color-on-tertiary-container` at `38%` |
|
|
258
|
+
| supporting-text, trailing-supporting-text | `--md-sys-color-on-tertiary-container` | `--md-sys-color-on-tertiary-container` | `--md-sys-color-on-tertiary` | `--md-sys-color-on-tertiary-container` at `38%` |
|
|
259
|
+
| state-layer | | `--md-sys-color-on-tertiary-container` | `--md-sys-color-on-tertiary` | |
|
|
334
260
|
|
|
335
261
|
**Example: Changing the maximum width**
|
|
336
262
|
|
|
@@ -19,7 +19,6 @@
|
|
|
19
19
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
20
|
// SOFTWARE.
|
|
21
21
|
|
|
22
|
-
@use '../../foundations';
|
|
23
22
|
@use '../../styles/elevation';
|
|
24
23
|
@use '../../styles/motion';
|
|
25
24
|
@use '../../styles/shape';
|
|
@@ -43,23 +42,17 @@
|
|
|
43
42
|
@include typography.scale('label-small');
|
|
44
43
|
@include typography.scale('body-small');
|
|
45
44
|
|
|
46
|
-
:root {
|
|
47
|
-
--md-comp-menu-width-max: 320px;
|
|
48
|
-
--md-comp-menu-width-min: 112px;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
45
|
$menu-padding-block: 4px;
|
|
52
46
|
$item-classes: ':is(.micl-list-item-one, .micl-list-item-two, .micl-list-item-three)';
|
|
53
47
|
|
|
54
|
-
@mixin menu-color-set(
|
|
55
|
-
$
|
|
56
|
-
$container
|
|
57
|
-
$on-container
|
|
58
|
-
$on-
|
|
59
|
-
$
|
|
60
|
-
$selected-
|
|
61
|
-
|
|
62
|
-
) {
|
|
48
|
+
@mixin menu-color-set($variant) {
|
|
49
|
+
$container: var(--_menu-item-bg);
|
|
50
|
+
$on-container: var(--_menu-on);
|
|
51
|
+
$on-container-strong: var(--_menu-on-strong);
|
|
52
|
+
$on-icon-active: var(--_menu-icon-active);
|
|
53
|
+
$selected-container: var(--_menu-selected-bg);
|
|
54
|
+
$on-selected: var(--_menu-on-selected);
|
|
55
|
+
|
|
63
56
|
--md-comp-list-item-container-color: var(--md-comp-menu-#{$variant}-menu-item-container-color, #{$container});
|
|
64
57
|
--md-comp-list-item-label-text-color: var(--md-comp-menu-#{$variant}-menu-item-label-text-color, #{$on-container});
|
|
65
58
|
--md-comp-list-item-leading-icon-color: var(--md-comp-menu-#{$variant}-menu-item-leading-icon-color, #{$on-container});
|
|
@@ -68,15 +61,15 @@ $item-classes: ':is(.micl-list-item-one, .micl-list-item-two, .micl-list-item-th
|
|
|
68
61
|
--md-comp-list-item-trailing-supporting-text-color: var(--md-comp-menu-#{$variant}-menu-item-trailing-supporting-text-color, #{$on-container});
|
|
69
62
|
|
|
70
63
|
--md-comp-list-item-disabled-label-text-color: var(--md-comp-menu-#{$variant}-menu-item-disabled-label-text-color, #{$on-container-strong});
|
|
71
|
-
--md-comp-list-item-disabled-label-text-opacity: var(--md-comp-menu-#{$variant}-menu-item-disabled-label-text-opacity, var(--
|
|
64
|
+
--md-comp-list-item-disabled-label-text-opacity: var(--md-comp-menu-#{$variant}-menu-item-disabled-label-text-opacity, var(--_menu-do));
|
|
72
65
|
--md-comp-list-item-disabled-leading-icon-color: var(--md-comp-menu-#{$variant}-menu-item-disabled-leading-icon-color, #{$on-container-strong});
|
|
73
|
-
--md-comp-list-item-disabled-leading-icon-opacity: var(--md-comp-menu-#{$variant}-menu-item-disabled-leading-icon-opacity, var(--
|
|
66
|
+
--md-comp-list-item-disabled-leading-icon-opacity: var(--md-comp-menu-#{$variant}-menu-item-disabled-leading-icon-opacity, var(--_menu-do));
|
|
74
67
|
--md-comp-list-item-disabled-supporting-text-color: var(--md-comp-menu-#{$variant}-menu-item-disabled-supporting-text-color, #{$on-container-strong});
|
|
75
|
-
--md-comp-list-item-disabled-supporting-text-opacity: var(--md-comp-menu-#{$variant}-menu-item-disabled-supporting-text-opacity, var(--
|
|
68
|
+
--md-comp-list-item-disabled-supporting-text-opacity: var(--md-comp-menu-#{$variant}-menu-item-disabled-supporting-text-opacity, var(--_menu-do));
|
|
76
69
|
--md-comp-list-item-disabled-trailing-icon-color: var(--md-comp-menu-#{$variant}-menu-item-disabled-trailing-icon-color, #{$on-container-strong});
|
|
77
|
-
--md-comp-list-item-disabled-trailing-icon-opacity: var(--md-comp-menu-#{$variant}-menu-item-disabled-trailing-icon-opacity, var(--
|
|
70
|
+
--md-comp-list-item-disabled-trailing-icon-opacity: var(--md-comp-menu-#{$variant}-menu-item-disabled-trailing-icon-opacity, var(--_menu-do));
|
|
78
71
|
--md-comp-list-item-disabled-trailing-supporting-text-color: var(--md-comp-menu-#{$variant}-menu-item-disabled-trailing-supporting-text-color, #{$on-container-strong});
|
|
79
|
-
--md-comp-list-item-disabled-trailing-supporting-text-opacity: var(--md-comp-menu-#{$variant}-menu-item-disabled-trailing-supporting-text-opacity, var(--
|
|
72
|
+
--md-comp-list-item-disabled-trailing-supporting-text-opacity: var(--md-comp-menu-#{$variant}-menu-item-disabled-trailing-supporting-text-opacity, var(--_menu-do));
|
|
80
73
|
|
|
81
74
|
--md-comp-list-item-focus-label-text-color: var(--md-comp-menu-#{$variant}-menu-item-focused-label-text-color, #{$on-container-strong});
|
|
82
75
|
--md-comp-list-item-focus-leading-icon-color: var(--md-comp-menu-#{$variant}-menu-item-focused-leading-icon-color, #{$on-icon-active});
|
|
@@ -110,15 +103,15 @@ $item-classes: ':is(.micl-list-item-one, .micl-list-item-two, .micl-list-item-th
|
|
|
110
103
|
--md-comp-list-item-selected-trailing-supporting-text-color: var(--md-comp-menu-#{$variant}-menu-item-selected-trailing-supporting-text-color, #{$on-selected});
|
|
111
104
|
|
|
112
105
|
--md-comp-list-item-selected-disabled-container-color: var(--md-comp-menu-#{$variant}-menu-item-selected-disabled-container-color, #{$selected-container});
|
|
113
|
-
--md-comp-list-item-selected-disabled-container-opacity: var(--md-comp-menu-#{$variant}-menu-item-selected-disabled-container-opacity, var(--
|
|
106
|
+
--md-comp-list-item-selected-disabled-container-opacity: var(--md-comp-menu-#{$variant}-menu-item-selected-disabled-container-opacity, var(--_menu-do));
|
|
114
107
|
--md-comp-list-item-selected-disabled-label-text-color: var(--md-comp-menu-#{$variant}-menu-item-selected-disabled-label-text-color, #{$on-selected});
|
|
115
|
-
--md-comp-list-item-selected-disabled-label-text-opacity: var(--md-comp-menu-#{$variant}-menu-item-selected-disabled-label-text-opacity, var(--
|
|
108
|
+
--md-comp-list-item-selected-disabled-label-text-opacity: var(--md-comp-menu-#{$variant}-menu-item-selected-disabled-label-text-opacity, var(--_menu-do));
|
|
116
109
|
--md-comp-list-item-selected-disabled-leading-icon-color: var(--md-comp-menu-#{$variant}-menu-item-selected-disabled-leading-icon-color, #{$on-selected});
|
|
117
|
-
--md-comp-list-item-selected-disabled-leading-icon-opacity: var(--md-comp-menu-#{$variant}-menu-item-selected-disabled-leading-icon-opacity, var(--
|
|
110
|
+
--md-comp-list-item-selected-disabled-leading-icon-opacity: var(--md-comp-menu-#{$variant}-menu-item-selected-disabled-leading-icon-opacity, var(--_menu-do));
|
|
118
111
|
--md-comp-list-item-selected-disabled-trailing-icon-color: var(--md-comp-menu-#{$variant}-menu-item-selected-disabled-trailing-icon-color, #{$on-selected});
|
|
119
|
-
--md-comp-list-item-selected-disabled-trailing-icon-opacity: var(--md-comp-menu-#{$variant}-menu-item-selected-disabled-trailing-icon-opacity, var(--
|
|
112
|
+
--md-comp-list-item-selected-disabled-trailing-icon-opacity: var(--md-comp-menu-#{$variant}-menu-item-selected-disabled-trailing-icon-opacity, var(--_menu-do));
|
|
120
113
|
--md-comp-list-item-selected-disabled-trailing-supporting-text-color: var(--md-comp-menu-#{$variant}-menu-item-selected-disabled-trailing-supporting-text-color, #{$on-selected});
|
|
121
|
-
--md-comp-list-item-selected-disabled-trailing-supporting-text-opacity: var(--md-comp-menu-#{$variant}-menu-item-selected-disabled-trailing-supporting-text-opacity, var(--
|
|
114
|
+
--md-comp-list-item-selected-disabled-trailing-supporting-text-opacity: var(--md-comp-menu-#{$variant}-menu-item-selected-disabled-trailing-supporting-text-opacity, var(--_menu-do));
|
|
122
115
|
|
|
123
116
|
--md-comp-list-item-selected-focus-label-text-color: var(--md-comp-menu-#{$variant}-menu-item-selected-focused-label-text-color, #{$on-selected});
|
|
124
117
|
--md-comp-list-item-selected-focus-leading-icon-color: var(--md-comp-menu-#{$variant}-menu-item-selected-focused-leading-icon-color, #{$on-selected});
|
|
@@ -173,15 +166,15 @@ $item-classes: ':is(.micl-list-item-one, .micl-list-item-two, .micl-list-item-th
|
|
|
173
166
|
--md-comp-list-item-focus-indicator-offset: var(--md-comp-menu-item-focus-indicator-offset, var(--md-sys-state-focus-indicator-inner-offset, -3px));
|
|
174
167
|
--md-comp-list-item-focus-indicator-thickness: var(--md-comp-menu-item-focus-indicator-thickness, var(--md-sys-state-focus-indicator-thickness, 3px));
|
|
175
168
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
);
|
|
169
|
+
--_menu-item-bg: var(--md-sys-color-surface-container-low);
|
|
170
|
+
--_menu-on: var(--md-sys-color-on-surface-variant);
|
|
171
|
+
--_menu-on-strong: var(--md-sys-color-on-surface);
|
|
172
|
+
--_menu-icon-active: var(--md-sys-color-on-surface-variant);
|
|
173
|
+
--_menu-selected-bg: var(--md-sys-color-tertiary-container);
|
|
174
|
+
--_menu-on-selected: var(--md-sys-color-on-tertiary-container);
|
|
175
|
+
--_menu-do: var(--md-sys-state-disabled-state-layer-opacity, 38%);
|
|
176
|
+
|
|
177
|
+
@include menu-color-set('standard');
|
|
185
178
|
|
|
186
179
|
.micl-menu__section {
|
|
187
180
|
@include typography.label-small;
|
|
@@ -206,7 +199,6 @@ $item-classes: ':is(.micl-list-item-one, .micl-list-item-two, .micl-list-item-th
|
|
|
206
199
|
}
|
|
207
200
|
|
|
208
201
|
.micl-menu[popover] {
|
|
209
|
-
display: flex;
|
|
210
202
|
flex-direction: column;
|
|
211
203
|
position: absolute;
|
|
212
204
|
inset: unset;
|
|
@@ -221,24 +213,27 @@ $item-classes: ':is(.micl-list-item-one, .micl-list-item-two, .micl-list-item-th
|
|
|
221
213
|
border: none;
|
|
222
214
|
outline: none;
|
|
223
215
|
background-color: transparent;
|
|
216
|
+
--micl-duration: var(--md-comp-menu-motion-spatial-duration-reverse);
|
|
217
|
+
--micl-easing: linear;
|
|
218
|
+
--_group-shape: var(--md-comp-menu-group-shape, var(--md-sys-shape-corner-small, 8px));
|
|
219
|
+
|
|
224
220
|
opacity: 0;
|
|
225
221
|
overflow: visible;
|
|
226
222
|
transform: scaleY(0);
|
|
227
223
|
transform-origin: center top;
|
|
228
224
|
transition:
|
|
229
|
-
opacity var(--
|
|
230
|
-
transform var(--
|
|
231
|
-
overlay var(--
|
|
232
|
-
display var(--
|
|
225
|
+
opacity var(--micl-duration) var(--micl-easing),
|
|
226
|
+
transform var(--micl-duration) var(--md-comp-menu-motion-spatial),
|
|
227
|
+
overlay var(--micl-duration) linear allow-discrete,
|
|
228
|
+
display var(--micl-duration) linear allow-discrete;
|
|
233
229
|
|
|
234
230
|
&:popover-open {
|
|
231
|
+
--micl-duration: var(--md-comp-menu-motion-spatial-duration);
|
|
232
|
+
--micl-easing: #{motion.$md-sys-motion-easing-emphasized-decelerate};
|
|
233
|
+
|
|
234
|
+
display: flex;
|
|
235
235
|
opacity: 1;
|
|
236
236
|
transform: scaleY(1);
|
|
237
|
-
transition:
|
|
238
|
-
opacity var(--md-comp-menu-motion-spatial-duration) motion.$md-sys-motion-easing-emphasized-decelerate,
|
|
239
|
-
transform var(--md-comp-menu-motion-spatial-duration) var(--md-comp-menu-motion-spatial),
|
|
240
|
-
overlay var(--md-comp-menu-motion-spatial-duration) linear allow-discrete,
|
|
241
|
-
display var(--md-comp-menu-motion-spatial-duration) linear allow-discrete;
|
|
242
237
|
|
|
243
238
|
@starting-style {
|
|
244
239
|
opacity: 0;
|
|
@@ -268,12 +263,12 @@ $item-classes: ':is(.micl-list-item-one, .micl-list-item-two, .micl-list-item-th
|
|
|
268
263
|
transition: border-radius var(--md-comp-menu-motion-effects-duration-reverse) linear;
|
|
269
264
|
|
|
270
265
|
&+ .micl-list {
|
|
271
|
-
border-start-start-radius: var(--
|
|
272
|
-
border-start-end-radius: var(--
|
|
266
|
+
border-start-start-radius: var(--_group-shape);
|
|
267
|
+
border-start-end-radius: var(--_group-shape);
|
|
273
268
|
}
|
|
274
269
|
&:has(+ .micl-list) {
|
|
275
|
-
border-end-start-radius: var(--
|
|
276
|
-
border-end-end-radius: var(--
|
|
270
|
+
border-end-start-radius: var(--_group-shape);
|
|
271
|
+
border-end-end-radius: var(--_group-shape);
|
|
277
272
|
}
|
|
278
273
|
|
|
279
274
|
#{$item-classes} > .micl-menu[popover] {
|
|
@@ -296,20 +291,19 @@ $item-classes: ':is(.micl-list-item-one, .micl-list-item-two, .micl-list-item-th
|
|
|
296
291
|
}
|
|
297
292
|
|
|
298
293
|
&.micl-menu--vibrant > .micl-list {
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
);
|
|
294
|
+
--_menu-item-bg: var(--md-sys-color-tertiary-container);
|
|
295
|
+
--_menu-on: var(--md-sys-color-on-tertiary-container);
|
|
296
|
+
--_menu-on-strong: var(--md-sys-color-on-tertiary-container);
|
|
297
|
+
--_menu-icon-active: var(--md-sys-color-tertiary);
|
|
298
|
+
--_menu-selected-bg: var(--md-sys-color-tertiary);
|
|
299
|
+
--_menu-on-selected: var(--md-sys-color-on-tertiary);
|
|
300
|
+
|
|
301
|
+
@include menu-color-set('vibrant');
|
|
308
302
|
|
|
309
303
|
background-color: var(--md-comp-menu-vibrant-container-color, var(--md-sys-color-tertiary-container));
|
|
310
304
|
}
|
|
311
305
|
}
|
|
312
306
|
|
|
313
|
-
|
|
307
|
+
.micl-menu[popover] > .micl-list button[popovertarget] .micl-list-item__icon:dir(rtl) {
|
|
314
308
|
transform: rotate(180deg);
|
|
315
309
|
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# Navigation bar
|
|
2
|
+
This component implements the [Material Design 3 Expressive Navigation bar](https://m3.material.io/components/navigation-bar/overview) design. A navigation bar lets people switch between UI views on smaller devices, anchored to the bottom of the screen.
|
|
3
|
+
|
|
4
|
+
## Basic Usage
|
|
5
|
+
|
|
6
|
+
### HTML
|
|
7
|
+
To create a navigation bar, use a `<nav>` element with the `micl-navigationbar` class. Inside, use anchor elements `<a>` to create the selectable navigation items. The markup mirrors the Navigation rail component.
|
|
8
|
+
|
|
9
|
+
```HTML
|
|
10
|
+
<nav id="mynavigationbar" class="micl-navigationbar">
|
|
11
|
+
<div class="micl-navigationbar__content" role="menu">
|
|
12
|
+
<a href="#" class="micl-navigationbar__item" role="menuitem" aria-current="page">
|
|
13
|
+
<span class="micl-navigationbar__icon material-symbols-outlined" aria-hidden="true">inbox</span>
|
|
14
|
+
<span class="micl-navigationbar__text">Inbox</span>
|
|
15
|
+
</a>
|
|
16
|
+
<a href="#" class="micl-navigationbar__item" role="menuitem">
|
|
17
|
+
<span class="micl-navigationbar__icon material-symbols-outlined" aria-hidden="true">outbox</span>
|
|
18
|
+
<span class="micl-navigationbar__text">Outbox</span>
|
|
19
|
+
</a>
|
|
20
|
+
</div>
|
|
21
|
+
</nav>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Use three to five items. The navigation bar is fixed to the bottom of the screen (respecting any safe-area inset), and the component automatically reserves matching space at the bottom of the page so that the content is not obscured.
|
|
25
|
+
|
|
26
|
+
> [!WARNING]
|
|
27
|
+
> The navigation bar component adds a `padding-block-end` CSS rule to the `<body>` element to reserve space for the bar. It matches the height of the displayed variant (including any safe-area inset) and is removed while an adaptive navigation bar is displayed as a navigation rail. Overriding this rule may cause page content to be obscured by the bar.
|
|
28
|
+
|
|
29
|
+
### CSS
|
|
30
|
+
Import the navigation bar styles into your project:
|
|
31
|
+
|
|
32
|
+
```CSS
|
|
33
|
+
@use "material-inspired-component-library/dist/navigationbar";
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Or import all MICL styles:
|
|
37
|
+
```CSS
|
|
38
|
+
@use "material-inspired-component-library/styles";
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### JavaScript
|
|
42
|
+
No custom JavaScript is required for the core functionality of this component.
|
|
43
|
+
|
|
44
|
+
### Live Demo
|
|
45
|
+
A live example of the [Navigation bar component](https://henkpb.github.io/micl/navigationbar.html) is available to interact with.
|
|
46
|
+
|
|
47
|
+
## Variants
|
|
48
|
+
|
|
49
|
+
### Tall navigation bar
|
|
50
|
+
The **tall** navigation bar is 80px high instead of 64px, with the items vertically centered.
|
|
51
|
+
|
|
52
|
+
```HTML
|
|
53
|
+
<nav class="micl-navigationbar micl-navigationbar--tall">
|
|
54
|
+
...
|
|
55
|
+
</nav>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Horizontal items
|
|
59
|
+
On wider compact devices (for example phones in landscape), the items can show the icon and label side by side in a single 40px-high pill.
|
|
60
|
+
|
|
61
|
+
```HTML
|
|
62
|
+
<nav class="micl-navigationbar micl-navigationbar--horizontal">
|
|
63
|
+
...
|
|
64
|
+
</nav>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Adaptive navigation
|
|
68
|
+
An **adaptive** navigation bar acts as a navigation bar on narrow screens and is displayed as a permanently visible, collapsed [Navigation rail](../navigationrail/README.md) on wide screens. Add one of the following modifier classes:
|
|
69
|
+
|
|
70
|
+
| Class | Navigation bar below | Navigation rail from |
|
|
71
|
+
| ----- | -------------------- | -------------------- |
|
|
72
|
+
| `micl-navigationbar--bar-to-medium` | `600px` | `600px` |
|
|
73
|
+
| `micl-navigationbar--bar-to-expanded` | `840px` | `840px` |
|
|
74
|
+
|
|
75
|
+
```HTML
|
|
76
|
+
<nav class="micl-navigationbar micl-navigationbar--bar-to-medium">
|
|
77
|
+
...
|
|
78
|
+
</nav>
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Place the `<nav>` element before the main content, where a standard navigation rail would go, so that it occupies its usual position when the wide-screen layout applies. On wide screens the component is themed by the `--md-comp-nav-rail-*` custom properties of the Navigation rail component. Do not combine the adaptive classes with the `micl-navigationbar--tall` or `micl-navigationbar--horizontal` variants.
|
|
82
|
+
|
|
83
|
+
## Theming
|
|
84
|
+
Each navigation bar can be themed with CSS custom properties that follow the Material Design 3 component-token naming convention.
|
|
85
|
+
|
|
86
|
+
| Custom property | Meaning | Default |
|
|
87
|
+
|---|---|---|
|
|
88
|
+
| `--md-comp-nav-bar-container-color` | The background color of the navigation bar | `--md-sys-color-surface-container` |
|
|
89
|
+
| `--md-comp-nav-bar-container-elevation` | The shadow (elevation) of the navigation bar | `--md-sys-elevation-level2` |
|
|
90
|
+
| `--md-comp-nav-bar-container-height` | The height of the navigation bar (excluding any safe-area inset) | `64px` |
|
|
91
|
+
| `--md-comp-nav-bar-tall-container-height` | The height of the tall navigation bar | `80px` |
|
|
92
|
+
| `--md-comp-nav-bar-container-shape` | The corner rounding of the navigation bar | `0px` |
|
|
93
|
+
| `--md-comp-nav-bar-item-icon-size` | The size of the item icons | `--md-sys-icon-size` |
|
|
94
|
+
| `--md-comp-nav-bar-item-active-indicator-shape` | The corner rounding of an item's active indicator | half the indicator height |
|
|
95
|
+
| `--md-comp-nav-bar-item-active-indicator-icon-label-space` | The space between the icon and the label | `4px` |
|
|
96
|
+
| `--md-comp-nav-bar-item-vertical-active-indicator-width` | The width of an item's active indicator | `56px` |
|
|
97
|
+
| `--md-comp-nav-bar-item-vertical-active-indicator-height` | The height of an item's active indicator | `32px` |
|
|
98
|
+
| `--md-comp-nav-bar-item-horizontal-active-indicator-height` | The height of an item's active indicator with horizontal items | `40px` |
|
|
99
|
+
| `--md-comp-nav-bar-item-horizontal-active-indicator-leading-space` | The space between the start edge of a horizontal item's active indicator and the icon | `16px` |
|
|
100
|
+
| `--md-comp-nav-bar-item-horizontal-active-indicator-trailing-space` | The space between the label and the end edge of a horizontal item's active indicator | `16px` |
|
|
101
|
+
|
|
102
|
+
**Example: Changing the background color of the navigation bar**
|
|
103
|
+
|
|
104
|
+
```HTML
|
|
105
|
+
<nav class="micl-navigationbar" style="--md-comp-nav-bar-container-color:var(--md-sys-color-surface)">
|
|
106
|
+
...
|
|
107
|
+
</nav>
|
|
108
|
+
```
|