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
|
@@ -36,27 +36,29 @@ The Radio Button component respects the `dir` global attribute, automatically ad
|
|
|
36
36
|
|
|
37
37
|
The component applies `cursor: pointer` and the color role **on surface** to the `<label>` element immediately preceding or following an `<input type="radio">` with the `micl-radio` class. You are encouraged to customize these CSS settings to match your design system.
|
|
38
38
|
|
|
39
|
-
##
|
|
40
|
-
|
|
39
|
+
## Theming
|
|
40
|
+
Each radio button can be themed with CSS custom properties that follow the Material Design 3 component-token naming convention. Set them on any appropriate parent element to affect its child radio buttons.
|
|
41
41
|
|
|
42
|
-
|
|
|
43
|
-
|
|
44
|
-
|
|
|
45
|
-
|
|
|
42
|
+
| Custom property | Meaning | Default |
|
|
43
|
+
|---|---|---|
|
|
44
|
+
| `--md-comp-radio-button-icon-size` | The diameter of the radio button itself | `20px` |
|
|
45
|
+
| `--md-comp-radio-button-outline-width` | The thickness of the radio button's ring | `2px` |
|
|
46
|
+
| `--md-comp-radio-button-unselected-icon-color` | The ring color of an unselected radio button | `--md-sys-color-on-surface-variant` |
|
|
47
|
+
| `--md-comp-radio-button-selected-icon-color` | The ring and dot color of a selected radio button | `--md-sys-color-primary` |
|
|
46
48
|
|
|
47
49
|
**Example: Changing the size of the radio button**
|
|
48
50
|
|
|
49
51
|
```HTML
|
|
50
|
-
<div style="--md-
|
|
52
|
+
<div style="--md-comp-radio-button-icon-size:28px">
|
|
51
53
|
<input type="radio" id="myradio" class="micl-radio">
|
|
52
54
|
<label for="myradio">Large radio button</label>
|
|
53
55
|
</div>
|
|
54
56
|
```
|
|
55
57
|
|
|
56
|
-
To vertically align a radio button with its label, wrap both in an element that has
|
|
58
|
+
To vertically align a radio button with its label, wrap both in an element that has a styling like suggested below:
|
|
57
59
|
|
|
58
60
|
```HTML
|
|
59
|
-
<div
|
|
61
|
+
<div style="display:flex;flex-direction:row;align-items:center">
|
|
60
62
|
<input type="radio" id="myradio" class="micl-radio">
|
|
61
63
|
<label for="myradio">Large radio button</label>
|
|
62
64
|
</div>
|
|
@@ -19,10 +19,10 @@
|
|
|
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/motion';
|
|
24
23
|
@use '../../styles/shape';
|
|
25
24
|
@use '../../styles/statelayer';
|
|
25
|
+
@use '../checkbox/label';
|
|
26
26
|
|
|
27
27
|
@include shape.corner('full');
|
|
28
28
|
|
|
@@ -37,15 +37,15 @@
|
|
|
37
37
|
@include statelayer.property;
|
|
38
38
|
@include statelayer.keyframes;
|
|
39
39
|
|
|
40
|
-
:
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
40
|
+
$radio: 'input[type=radio].micl-radio';
|
|
41
|
+
|
|
42
|
+
#{$radio} {
|
|
43
|
+
--md-comp-radio-button-motion-effects: #{motion.$md-sys-motion-expressive-slow-effects};
|
|
44
|
+
--md-comp-radio-button-motion-duration: #{motion.$md-sys-motion-expressive-slow-effects-duration};
|
|
45
|
+
--md-comp-radio-button-motion-duration-reverse: #{motion.$md-sys-motion-expressive-default-effects-duration};
|
|
44
46
|
|
|
45
|
-
|
|
46
|
-
--
|
|
47
|
-
--md-sys-radio-motion-duration: #{motion.$md-sys-motion-expressive-slow-effects-duration};
|
|
48
|
-
--md-sys-radio-motion-duration-reverse: #{motion.$md-sys-motion-expressive-default-effects-duration};
|
|
47
|
+
--_size: var(--md-comp-radio-button-icon-size, 20px);
|
|
48
|
+
--_outline-width: var(--md-comp-radio-button-outline-width, 2px);
|
|
49
49
|
|
|
50
50
|
appearance: none;
|
|
51
51
|
box-sizing: border-box;
|
|
@@ -62,29 +62,32 @@ input[type=radio].micl-radio {
|
|
|
62
62
|
border-radius: var(--md-sys-shape-corner-full);
|
|
63
63
|
outline-offset: -7px;
|
|
64
64
|
|
|
65
|
+
// The ring and the dot in one box: the dot is the primary background clipped to the
|
|
66
|
+
// content box, hidden while the padding fills the ring, revealed when the checked
|
|
67
|
+
// padding shrinks to reveal a dot of half the icon size.
|
|
65
68
|
&::after {
|
|
66
69
|
content: "";
|
|
67
70
|
box-sizing: border-box;
|
|
68
71
|
position: absolute;
|
|
69
|
-
inline-size: var(--
|
|
70
|
-
block-size: var(--
|
|
72
|
+
inline-size: var(--_size);
|
|
73
|
+
block-size: var(--_size);
|
|
71
74
|
inset: 0;
|
|
72
75
|
margin: auto;
|
|
73
|
-
padding: calc((var(--
|
|
74
|
-
border: var(--md-
|
|
75
|
-
background-color: var(--md-sys-color-primary);
|
|
76
|
+
padding: calc((var(--_size) / 2) - var(--_outline-width));
|
|
77
|
+
border: var(--_outline-width) solid var(--md-comp-radio-button-unselected-icon-color, var(--md-sys-color-on-surface-variant));
|
|
78
|
+
background-color: var(--md-comp-radio-button-selected-icon-color, var(--md-sys-color-primary));
|
|
76
79
|
background-clip: content-box;
|
|
77
80
|
border-radius: var(--md-sys-shape-corner-full);
|
|
78
81
|
transition:
|
|
79
|
-
padding var(--md-
|
|
80
|
-
border-color var(--md-
|
|
82
|
+
padding var(--md-comp-radio-button-motion-duration-reverse) var(--md-comp-radio-button-motion-effects),
|
|
83
|
+
border-color var(--md-comp-radio-button-motion-duration-reverse) motion.$md-sys-motion-easing-emphasized;
|
|
81
84
|
}
|
|
82
85
|
&:checked::after {
|
|
83
|
-
border-color: var(--md-sys-color-primary);
|
|
84
|
-
padding:
|
|
86
|
+
border-color: var(--md-comp-radio-button-selected-icon-color, var(--md-sys-color-primary));
|
|
87
|
+
padding: calc(0.15 * var(--_size));
|
|
85
88
|
transition:
|
|
86
|
-
padding var(--md-
|
|
87
|
-
border-color var(--md-
|
|
89
|
+
padding var(--md-comp-radio-button-motion-duration) var(--md-comp-radio-button-motion-effects),
|
|
90
|
+
border-color var(--md-comp-radio-button-motion-duration) motion.$md-sys-motion-easing-emphasized;
|
|
88
91
|
}
|
|
89
92
|
&:not(:disabled) {
|
|
90
93
|
--micl-ripple: 1;
|
|
@@ -98,11 +101,12 @@ input[type=radio].micl-radio {
|
|
|
98
101
|
),
|
|
99
102
|
linear-gradient(rgb(from var(--statelayer-color) r g b / var(--statelayer-opacity)));
|
|
100
103
|
background-repeat: no-repeat;
|
|
104
|
+
background-position: var(--micl-x, center) var(--micl-y, center), 0 0;
|
|
101
105
|
background-size: 0%, 100%;
|
|
102
106
|
cursor: pointer;
|
|
103
107
|
transition:
|
|
104
108
|
background-size 0ms,
|
|
105
|
-
--statelayer-opacity var(--md-
|
|
109
|
+
--statelayer-opacity var(--md-comp-radio-button-motion-duration) linear;
|
|
106
110
|
|
|
107
111
|
&:hover,
|
|
108
112
|
&:focus-visible,
|
|
@@ -116,7 +120,7 @@ input[type=radio].micl-radio {
|
|
|
116
120
|
border-color: var(--md-sys-color-on-surface);
|
|
117
121
|
}
|
|
118
122
|
&:checked::after {
|
|
119
|
-
border-color: var(--md-sys-color-primary);
|
|
123
|
+
border-color: var(--md-comp-radio-button-selected-icon-color, var(--md-sys-color-primary));
|
|
120
124
|
}
|
|
121
125
|
}
|
|
122
126
|
&:hover {
|
|
@@ -131,7 +135,7 @@ input[type=radio].micl-radio {
|
|
|
131
135
|
--statelayer-opacity: var(--md-sys-state-pressed-state-layer-opacity, 10%);
|
|
132
136
|
}
|
|
133
137
|
&.micl-rippling {
|
|
134
|
-
animation: micl-ripple var(--md-sys-state-ripple-duration)
|
|
138
|
+
animation: micl-ripple var(--md-sys-state-ripple-duration);
|
|
135
139
|
}
|
|
136
140
|
}
|
|
137
141
|
&:disabled {
|
|
@@ -146,16 +150,15 @@ input[type=radio].micl-radio {
|
|
|
146
150
|
}
|
|
147
151
|
}
|
|
148
152
|
|
|
149
|
-
|
|
150
|
-
label:has(+
|
|
151
|
-
-
|
|
152
|
-
cursor: pointer;
|
|
153
|
+
#{$radio}:not(:disabled) + label,
|
|
154
|
+
label:has(+ #{$radio}:not(:disabled)) {
|
|
155
|
+
@extend %micl-toggle-label-pointer;
|
|
153
156
|
}
|
|
154
|
-
|
|
155
|
-
label:has(+
|
|
156
|
-
|
|
157
|
+
#{$radio} + label,
|
|
158
|
+
label:has(+ #{$radio}) {
|
|
159
|
+
@extend %micl-toggle-label;
|
|
157
160
|
}
|
|
158
|
-
|
|
159
|
-
label:has(+
|
|
160
|
-
|
|
161
|
+
#{$radio}:disabled + label,
|
|
162
|
+
label:has(+ #{$radio}:disabled) {
|
|
163
|
+
@extend %micl-toggle-label-disabled;
|
|
161
164
|
}
|
|
@@ -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, the select behaviour is included in `dist/textfield`.
|
|
44
45
|
|
|
45
46
|
This will initialize any Select component, including those that will be added to the DOM later on.
|
|
46
47
|
|
|
@@ -132,15 +133,19 @@ Options can be grouped by using the `<optgroup>` element. Add a `<legend>` eleme
|
|
|
132
133
|
</div>
|
|
133
134
|
```
|
|
134
135
|
|
|
135
|
-
##
|
|
136
|
-
|
|
136
|
+
## Theming
|
|
137
|
+
The Select component has no tokens of its own: the field is themed with the CSS custom properties of the [Text field](../textfield/README.md) component, and the option pick-list with those of the [Menu](../menu/README.md) and [List](../list/README.md) components. Set them on any appropriate parent element to affect its child selects.
|
|
137
138
|
|
|
138
|
-
|
|
139
|
-
| ------------------------------ | ------------- | ----------- |
|
|
140
|
-
| --md-comp-select-line-height | | The vertical line-height applied to the closed `<select>` element |
|
|
141
|
-
| --md-comp-select-picker-origin | left top | The transform-origin used for the open/close scale animation of the option pick-list |
|
|
139
|
+
**Example: A select with a compact field and a wider pick-list**
|
|
142
140
|
|
|
143
|
-
|
|
141
|
+
```HTML
|
|
142
|
+
<div class="micl-textfield-outlined" style="--md-comp-text-field-container-height:48px;--md-comp-menu-width-max:400px">
|
|
143
|
+
<label for="myselect">Country</label>
|
|
144
|
+
<select id="myselect">
|
|
145
|
+
...
|
|
146
|
+
</select>
|
|
147
|
+
</div>
|
|
148
|
+
```
|
|
144
149
|
|
|
145
150
|
## Compatibility
|
|
146
151
|
This component uses modern browser features to style the `<select>` element, which may not be fully supported in all browsers. Browsers that do not support these features will display a default select menu. Please check [Browser compatibility](https://developer.mozilla.org/en-US/docs/Web/CSS/::picker#browser_compatibility) for details.
|
|
@@ -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';
|
|
@@ -32,40 +31,41 @@
|
|
|
32
31
|
|
|
33
32
|
@include statelayer.token('disabled-state-layer-opacity');
|
|
34
33
|
|
|
34
|
+
// Each selector group compiles to a single selector.
|
|
35
|
+
$selects: ':is(.micl-textfield-filled, .micl-textfield-outlined) > select';
|
|
36
|
+
|
|
35
37
|
.micl-textfield-filled > select {
|
|
36
|
-
--
|
|
38
|
+
--_line-height: calc(var(--md-comp-text-field-container-height, 56px) - 18px - 3px);
|
|
37
39
|
}
|
|
38
40
|
.micl-textfield-outlined > select {
|
|
39
|
-
--
|
|
41
|
+
--_line-height: var(--md-comp-text-field-container-height, 56px);
|
|
40
42
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
--md-sys-divider-space: 8px;
|
|
43
|
+
#{$selects} {
|
|
44
|
+
--md-comp-list-motion-effects: #{motion.$md-sys-motion-expressive-fast-spatial};
|
|
44
45
|
--md-comp-list-motion-duration: #{motion.$md-sys-motion-expressive-default-effects-duration};
|
|
45
|
-
--md-comp-select-picker-origin: left top;
|
|
46
46
|
|
|
47
47
|
appearance: base-select;
|
|
48
|
-
line-height: var(--
|
|
48
|
+
line-height: var(--_line-height);
|
|
49
49
|
|
|
50
50
|
&::picker-icon {
|
|
51
|
-
color: var(--md-sys-color-on-surface-variant);
|
|
51
|
+
color: var(--md-comp-text-field-icon-color, var(--md-sys-color-on-surface-variant));
|
|
52
52
|
transition: motion.$md-sys-motion-duration-medium4 rotate;
|
|
53
|
-
transform-origin: 50% calc((var(--
|
|
53
|
+
transform-origin: 50% calc((var(--_line-height) / 2) - 1px);
|
|
54
54
|
}
|
|
55
55
|
&:disabled::picker-icon {
|
|
56
|
-
color: rgb(from var(--md-sys-color-on-surface
|
|
56
|
+
color: rgb(from var(--md-sys-color-on-surface) r g b / var(--md-sys-state-disabled-state-layer-opacity, 38%));
|
|
57
57
|
}
|
|
58
58
|
&:open::picker-icon {
|
|
59
59
|
rotate: 180deg;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
&::picker(select) {
|
|
63
|
-
--md-comp-
|
|
64
|
-
--md-comp-list-motion-duration: #{motion.$md-sys-motion-expressive-default-effects-duration};
|
|
65
|
-
--md-sys-divider-space: 0.5px;
|
|
63
|
+
--md-comp-divider-space: 0.5px;
|
|
66
64
|
--_list-shape: var(--md-comp-list-container-shape, var(--md-sys-shape-corner-large, 16px));
|
|
67
65
|
--_list-item-background-color: var(--md-comp-list-item-container-color, transparent);
|
|
68
66
|
--_list-item-background-opacity: 0%;
|
|
67
|
+
--micl-duration: var(--md-comp-menu-motion-spatial-duration-reverse);
|
|
68
|
+
--micl-easing: linear;
|
|
69
69
|
|
|
70
70
|
appearance: base-select;
|
|
71
71
|
display: flex;
|
|
@@ -85,21 +85,19 @@
|
|
|
85
85
|
overflow-x: hidden;
|
|
86
86
|
overflow-y: auto;
|
|
87
87
|
transform: scaleY(0);
|
|
88
|
-
transform-origin: var(--
|
|
88
|
+
transform-origin: var(--micl-select-picker-origin, top);
|
|
89
89
|
transition:
|
|
90
|
-
opacity var(--
|
|
91
|
-
transform var(--
|
|
92
|
-
overlay var(--
|
|
93
|
-
display var(--
|
|
90
|
+
opacity var(--micl-duration) var(--micl-easing),
|
|
91
|
+
transform var(--micl-duration) var(--md-comp-menu-motion-spatial),
|
|
92
|
+
overlay var(--micl-duration) linear allow-discrete,
|
|
93
|
+
display var(--micl-duration) linear allow-discrete;
|
|
94
94
|
|
|
95
95
|
&:popover-open {
|
|
96
|
+
--micl-duration: var(--md-comp-menu-motion-spatial-duration);
|
|
97
|
+
--micl-easing: #{motion.$md-sys-motion-easing-emphasized-decelerate};
|
|
98
|
+
|
|
96
99
|
opacity: 1;
|
|
97
100
|
transform: scaleY(1);
|
|
98
|
-
transition:
|
|
99
|
-
opacity var(--md-comp-menu-motion-spatial-duration) motion.$md-sys-motion-easing-emphasized-decelerate,
|
|
100
|
-
transform var(--md-comp-menu-motion-spatial-duration) var(--md-comp-menu-motion-spatial),
|
|
101
|
-
overlay var(--md-comp-menu-motion-spatial-duration) linear allow-discrete,
|
|
102
|
-
display var(--md-comp-menu-motion-spatial-duration) linear allow-discrete;
|
|
103
101
|
|
|
104
102
|
@starting-style {
|
|
105
103
|
opacity: 0;
|
|
@@ -117,21 +115,15 @@
|
|
|
117
115
|
text-overflow: ellipsis;
|
|
118
116
|
}
|
|
119
117
|
&::checkmark {
|
|
120
|
-
color: var(--
|
|
118
|
+
color: var(--_trailing-icon-color);
|
|
121
119
|
}
|
|
122
120
|
}
|
|
123
121
|
}
|
|
124
122
|
|
|
125
|
-
[inert]
|
|
126
|
-
[inert] .micl-textfield-outlined > select::picker-icon {
|
|
123
|
+
[inert] #{$selects}::picker-icon {
|
|
127
124
|
display: none;
|
|
128
125
|
}
|
|
129
126
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
.micl-textfield-outlined > select {
|
|
133
|
-
&:open::picker-icon {
|
|
134
|
-
rotate: -180deg;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
127
|
+
#{$selects}:dir(rtl):open::picker-icon {
|
|
128
|
+
rotate: -180deg;
|
|
137
129
|
}
|
|
@@ -76,17 +76,17 @@ Optional modifier classes:
|
|
|
76
76
|
The base styles size the SVG to 100 × 100 px, fill it with the application's primary color, and let it overflow its viewBox horizontally (so wide shapes like *pill* and *fan* are not clipped). Override these on the element or on a parent:
|
|
77
77
|
|
|
78
78
|
```HTML
|
|
79
|
-
<svg class="micl-
|
|
79
|
+
<svg class="micl-shapes micl-shapes--diamond"
|
|
80
80
|
viewBox="0 0 100 100"
|
|
81
81
|
style="inline-size:64px;block-size:64px;fill:var(--md-sys-color-secondary)">
|
|
82
82
|
<path />
|
|
83
83
|
</svg>
|
|
84
84
|
```
|
|
85
85
|
|
|
86
|
-
For `micl-
|
|
86
|
+
For `micl-shapes--outlined`, the stroke colour and width are controlled by the standard SVG `stroke` and `stroke-width` properties:
|
|
87
87
|
|
|
88
88
|
```HTML
|
|
89
|
-
<svg class="micl-
|
|
89
|
+
<svg class="micl-shapes micl-shapes--outlined micl-shapes--pill"
|
|
90
90
|
viewBox="0 0 100 100"
|
|
91
91
|
style="stroke:var(--md-sys-color-outline);stroke-width:3">
|
|
92
92
|
<path />
|
|
@@ -26,6 +26,9 @@ To create a standard side sheet, use the `<dialog>` element with the `popover` a
|
|
|
26
26
|
Import the side sheet styles into your project:
|
|
27
27
|
|
|
28
28
|
```CSS
|
|
29
|
+
@use "material-inspired-component-library/dist/button";
|
|
30
|
+
@use "material-inspired-component-library/dist/iconbutton";
|
|
31
|
+
@use "material-inspired-component-library/dist/divider";
|
|
29
32
|
@use "material-inspired-component-library/dist/sidesheet";
|
|
30
33
|
```
|
|
31
34
|
|
|
@@ -77,7 +80,7 @@ To open a standard or modal side sheet, link a button to the side sheet's ID usi
|
|
|
77
80
|
The back-button and the actions-container are optional. To remove the vertical divider of the standard side sheet, assign zero to the following CSS variable:
|
|
78
81
|
```CSS
|
|
79
82
|
#mysidesheet {
|
|
80
|
-
--md-
|
|
83
|
+
--md-comp-sidesheet-divider-thickness: 0;
|
|
81
84
|
}
|
|
82
85
|
```
|
|
83
86
|
|
|
@@ -90,19 +93,28 @@ The back-button and the actions-container are optional. To remove the vertical d
|
|
|
90
93
|
> transition: ...transition on max-inline-size...
|
|
91
94
|
> ```
|
|
92
95
|
|
|
93
|
-
##
|
|
94
|
-
|
|
96
|
+
## Theming
|
|
97
|
+
Each side sheet style can be themed with CSS custom properties that follow the Material Design 3 component-token naming convention.
|
|
98
|
+
|
|
99
|
+
| Custom property | Meaning | Default |
|
|
100
|
+
|---|---|---|
|
|
101
|
+
| `--md-comp-sidesheet-container-width` | The default (and minimum allowed) width of the side sheet | `256px` |
|
|
102
|
+
| `--md-comp-sidesheet-container-max-width` | The largest allowed width of the side sheet | `400px` |
|
|
103
|
+
| `--md-comp-sidesheet-padding` | The amount of space between the vertical edges and the content | `--md-sys-layout-window-margin` |
|
|
104
|
+
| `--md-comp-sidesheet-container-shape` | The corner rounding of the standard side sheet | `--md-sys-shape-corner-none` |
|
|
105
|
+
| `--md-comp-sidesheet-standard-container-color` | The background color of the standard side sheet | `--md-sys-color-surface` |
|
|
106
|
+
| `--md-comp-sidesheet-divider-thickness` | The thickness of the vertical divider of the standard side sheet | `1px` |
|
|
107
|
+
| `--md-comp-sidesheet-divider-color` | The color of the vertical divider of the standard side sheet | `--md-sys-color-outline` |
|
|
108
|
+
| `--md-comp-sidesheet-standard-container-elevation` | The shadow (elevation) of the standard side sheet | `--md-sys-elevation-level0` |
|
|
109
|
+
| `--md-comp-sidesheet-modal-container-color` | The background color of the modal side sheet | `--md-sys-color-surface-container-low` |
|
|
110
|
+
| `--md-comp-sidesheet-modal-container-elevation` | The shadow (elevation) of the modal side sheet | `--md-sys-elevation-level1` |
|
|
111
|
+
| `--md-comp-sidesheet-modal-container-shape` | The corner rounding of the modal side sheet, applied to the two corners facing the content | `--md-sys-shape-corner-large` |
|
|
95
112
|
|
|
96
|
-
| Variable name | Default Value | Description |
|
|
97
|
-
| ------------- | ------------- | ----------- |
|
|
98
|
-
| --md-sys-sidesheet-width | 256px | The default (and minimum allowed) width of the side sheet |
|
|
99
|
-
| --md-sys-sidesheet-maxwidth | 400px | The largest allowed width of the side sheet |
|
|
100
|
-
| --md-sys-sidesheet-padding-standard | 24px | The amount of space between the vertical edges and the content |
|
|
101
113
|
|
|
102
114
|
**Example: Changing the width of the sidesheet**
|
|
103
115
|
|
|
104
116
|
```HTML
|
|
105
|
-
<body style="--md-
|
|
117
|
+
<body style="--md-comp-sidesheet-container-width:320px">
|
|
106
118
|
<dialog id="mysidesheet" class="micl-sidesheet" popover>
|
|
107
119
|
...
|
|
108
120
|
</dialog>
|
|
@@ -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 '../../foundations/layout';
|
|
24
23
|
@use '../../styles/elevation';
|
|
25
24
|
@use '../../styles/motion';
|
|
@@ -38,50 +37,49 @@
|
|
|
38
37
|
@include typography.scale('title-large');
|
|
39
38
|
|
|
40
39
|
:root {
|
|
41
|
-
--md-
|
|
42
|
-
--md-
|
|
43
|
-
--md-
|
|
40
|
+
--md-comp-sidesheet-container-width: 256px;
|
|
41
|
+
--md-comp-sidesheet-container-max-width: 400px;
|
|
42
|
+
--md-comp-sidesheet-padding: var(--md-sys-layout-window-margin, 24px);
|
|
44
43
|
}
|
|
45
44
|
body {
|
|
46
|
-
--md-
|
|
47
|
-
--md-
|
|
48
|
-
--md-
|
|
45
|
+
--md-comp-sidesheet-motion-spatial: #{motion.$md-sys-motion-expressive-slow-spatial};
|
|
46
|
+
--md-comp-sidesheet-motion-duration: #{motion.$md-sys-motion-expressive-slow-spatial-duration};
|
|
47
|
+
--md-comp-sidesheet-motion-duration-reverse: #{motion.$md-sys-motion-expressive-default-spatial-duration};
|
|
49
48
|
}
|
|
50
49
|
|
|
51
50
|
dialog.micl-sidesheet {
|
|
52
|
-
--
|
|
51
|
+
--micl-spring-buffer: 40px;
|
|
52
|
+
--micl-duration: var(--md-comp-sidesheet-motion-duration-reverse);
|
|
53
53
|
|
|
54
54
|
box-sizing: border-box;
|
|
55
55
|
display: none;
|
|
56
56
|
flex-direction: column;
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
block-size: 100vh;
|
|
61
|
-
max-block-size: 100%;
|
|
57
|
+
min-inline-size: calc(var(--md-comp-sidesheet-container-width) + var(--micl-spring-buffer));
|
|
58
|
+
max-inline-size: calc(var(--md-comp-sidesheet-container-max-width) + var(--micl-spring-buffer));
|
|
59
|
+
block-size: 100%;
|
|
62
60
|
min-block-size: 100%;
|
|
63
61
|
margin-block: 0;
|
|
64
62
|
margin-inline-start: auto;
|
|
65
|
-
margin-inline-end: calc(-1 * (var(--md-
|
|
66
|
-
padding-block: var(--md-
|
|
67
|
-
padding-inline: 0 var(--
|
|
68
|
-
background-color: var(--md-sys-color-surface);
|
|
63
|
+
margin-inline-end: calc(-1 * (var(--md-comp-sidesheet-container-max-width) + var(--micl-spring-buffer)));
|
|
64
|
+
padding-block: var(--md-comp-sidesheet-padding) 0;
|
|
65
|
+
padding-inline: 0 var(--micl-spring-buffer);
|
|
66
|
+
background-color: var(--md-comp-sidesheet-standard-container-color, var(--md-sys-color-surface));
|
|
69
67
|
border: none;
|
|
70
|
-
border-radius: var(--md-sys-shape-corner-none);
|
|
71
|
-
box-shadow: var(--md-sys-elevation-level0);
|
|
68
|
+
border-radius: var(--md-comp-sidesheet-container-shape, var(--md-sys-shape-corner-none));
|
|
69
|
+
box-shadow: var(--md-comp-sidesheet-standard-container-elevation, var(--md-sys-elevation-level0));
|
|
72
70
|
opacity: 0;
|
|
73
71
|
overflow: hidden;
|
|
74
72
|
transition:
|
|
75
|
-
opacity var(--
|
|
76
|
-
margin-inline-end var(--
|
|
77
|
-
overlay var(--
|
|
78
|
-
display var(--
|
|
73
|
+
opacity var(--micl-duration) linear,
|
|
74
|
+
margin-inline-end var(--micl-duration) var(--md-comp-sidesheet-motion-spatial),
|
|
75
|
+
overlay var(--micl-duration) linear allow-discrete,
|
|
76
|
+
display var(--micl-duration) linear allow-discrete;
|
|
79
77
|
|
|
80
78
|
.micl-sidesheet__headline {
|
|
81
79
|
display: flex;
|
|
82
80
|
align-items: center;
|
|
83
81
|
block-size: var(--md-sys-typescale-title-large-line-height);
|
|
84
|
-
padding-inline: var(--md-
|
|
82
|
+
padding-inline: var(--md-comp-sidesheet-padding);
|
|
85
83
|
margin-block-end: 16px;
|
|
86
84
|
column-gap: 12px;
|
|
87
85
|
color: var(--md-sys-color-on-surface-variant);
|
|
@@ -106,7 +104,7 @@ dialog.micl-sidesheet {
|
|
|
106
104
|
.micl-sidesheet__content {
|
|
107
105
|
box-sizing: border-box;
|
|
108
106
|
flex: 1 1 auto;
|
|
109
|
-
padding-inline: var(--md-
|
|
107
|
+
padding-inline: var(--md-comp-sidesheet-padding);
|
|
110
108
|
overflow: hidden auto;
|
|
111
109
|
}
|
|
112
110
|
.micl-sidesheet__actions {
|
|
@@ -115,46 +113,40 @@ dialog.micl-sidesheet {
|
|
|
115
113
|
flex-shrink: 0;
|
|
116
114
|
align-items: center;
|
|
117
115
|
justify-content: start;
|
|
118
|
-
padding-block: 16px var(--md-
|
|
119
|
-
padding-inline: var(--md-
|
|
116
|
+
padding-block: 16px var(--md-comp-sidesheet-padding);
|
|
117
|
+
padding-inline: var(--md-comp-sidesheet-padding);
|
|
120
118
|
column-gap: 8px;
|
|
121
119
|
overflow: hidden;
|
|
122
120
|
}
|
|
123
121
|
|
|
124
122
|
&[open] {
|
|
125
|
-
background-color: var(--md-sys-color-surface-container-low);
|
|
126
|
-
border-start-start-radius: var(--md-sys-shape-corner-large);
|
|
127
|
-
border-end-start-radius: var(--md-sys-shape-corner-large);
|
|
128
|
-
box-shadow: var(--md-sys-elevation-level1);
|
|
123
|
+
background-color: var(--md-comp-sidesheet-modal-container-color, var(--md-sys-color-surface-container-low));
|
|
124
|
+
border-start-start-radius: var(--md-comp-sidesheet-modal-container-shape, var(--md-sys-shape-corner-large));
|
|
125
|
+
border-end-start-radius: var(--md-comp-sidesheet-modal-container-shape, var(--md-sys-shape-corner-large));
|
|
126
|
+
box-shadow: var(--md-comp-sidesheet-modal-container-elevation, var(--md-sys-elevation-level1));
|
|
129
127
|
}
|
|
130
128
|
&:popover-open {
|
|
131
|
-
--md-
|
|
132
|
-
|
|
133
|
-
border-inline-start: var(--md-sys-divider-thickness, 1px) solid var(--md-sys-divider-color);
|
|
129
|
+
border-inline-start: var(--md-comp-sidesheet-divider-thickness, 1px) solid var(--md-comp-sidesheet-divider-color, var(--md-sys-color-outline, gray));
|
|
134
130
|
}
|
|
135
131
|
&:popover-open,
|
|
136
132
|
&[open] {
|
|
133
|
+
--micl-duration: var(--md-comp-sidesheet-motion-duration);
|
|
134
|
+
|
|
137
135
|
display: flex;
|
|
138
|
-
margin-inline-end: calc(-1 * var(--
|
|
136
|
+
margin-inline-end: calc(-1 * var(--micl-spring-buffer));
|
|
139
137
|
opacity: 100%;
|
|
140
|
-
transition:
|
|
141
|
-
opacity var(--md-sys-sidesheet-motion-duration) linear,
|
|
142
|
-
margin-inline-end var(--md-sys-sidesheet-motion-duration) var(--md-sys-sidesheet-motion-spatial),
|
|
143
|
-
overlay var(--md-sys-sidesheet-motion-duration) linear allow-discrete,
|
|
144
|
-
display var(--md-sys-sidesheet-motion-duration) linear allow-discrete;
|
|
145
138
|
|
|
146
139
|
@starting-style {
|
|
147
|
-
margin-inline-end: calc(-1 * (var(--md-
|
|
140
|
+
margin-inline-end: calc(-1 * (var(--md-comp-sidesheet-container-max-width) + var(--micl-spring-buffer)));
|
|
148
141
|
opacity: 0;
|
|
149
142
|
}
|
|
150
143
|
}
|
|
151
144
|
&::backdrop {
|
|
152
145
|
background-color: rgba(0, 0, 0, 0);
|
|
153
|
-
transition: background-color var(--
|
|
146
|
+
transition: background-color var(--micl-duration) linear;
|
|
154
147
|
}
|
|
155
148
|
&[open]::backdrop {
|
|
156
149
|
background-color: rgba(0, 0, 0, var(--md-sys-state-backdrop-opacity, 32%));
|
|
157
|
-
transition: background-color var(--md-sys-sidesheet-motion-duration) linear;
|
|
158
150
|
|
|
159
151
|
@starting-style {
|
|
160
152
|
background-color: rgba(0, 0, 0, 0);
|
|
@@ -166,9 +158,9 @@ body:has(dialog.micl-sidesheet[popover]) {
|
|
|
166
158
|
box-sizing: border-box;
|
|
167
159
|
max-inline-size: 100%;
|
|
168
160
|
margin: 0;
|
|
169
|
-
transition: max-inline-size var(--md-
|
|
161
|
+
transition: max-inline-size var(--md-comp-sidesheet-motion-duration-reverse);
|
|
170
162
|
}
|
|
171
163
|
body:has(dialog.micl-sidesheet:popover-open) {
|
|
172
|
-
max-inline-size: calc(100vw - var(--md-
|
|
173
|
-
transition: max-inline-size var(--md-
|
|
164
|
+
max-inline-size: calc(100vw - var(--md-comp-sidesheet-container-max-width));
|
|
165
|
+
transition: max-inline-size var(--md-comp-sidesheet-motion-duration) var(--md-comp-sidesheet-motion-spatial);
|
|
174
166
|
}
|
|
@@ -68,6 +68,27 @@ Adding the `disabled` boolean attribute to the `input` element causes the slider
|
|
|
68
68
|
|
|
69
69
|
The Slider component is aware of the `dir` global attribute that indicates the directionality of text.
|
|
70
70
|
|
|
71
|
+
## Theming
|
|
72
|
+
Each slider can be themed with CSS custom properties that follow the Material Design 3 component-token naming convention. The size properties default to the values of the chosen size class.
|
|
73
|
+
|
|
74
|
+
| Custom property | Meaning | Default |
|
|
75
|
+
|---|---|---|
|
|
76
|
+
| `--md-comp-slider-track-height` | The height of the slider track | `16px` / `24px` / `40px` / `56px` / `96px` per size |
|
|
77
|
+
| `--md-comp-slider-handle-height` | The height of the slider handle | `44px` / `44px` / `52px` / `68px` / `108px` per size |
|
|
78
|
+
| `--md-comp-slider-track-shape` | The corner rounding of the track | `small` / `small` / `medium` / `large` / `extra-large` per size |
|
|
79
|
+
| `--md-comp-slider-active-track-color` | The color of the active (filled) part of the track | `--md-sys-color-primary` |
|
|
80
|
+
| `--md-comp-slider-inactive-track-color` | The color of the inactive part of the track | `--md-sys-color-secondary-container` |
|
|
81
|
+
| `--md-comp-slider-handle-color` | The color of the handle | `--md-sys-color-primary` |
|
|
82
|
+
| `--md-comp-slider-stop-indicator-color` | The color of the tick marks (blended with the track) | `--md-sys-color-on-primary` |
|
|
83
|
+
| `--md-comp-slider-value-indicator-container-color` | The background color of the value indicator | `--md-sys-color-inverse-surface` |
|
|
84
|
+
| `--md-comp-slider-value-indicator-label-text-color` | The text color of the value indicator | `--md-sys-color-inverse-on-surface` |
|
|
85
|
+
|
|
86
|
+
**Example: Changing the track colors**
|
|
87
|
+
|
|
88
|
+
```HTML
|
|
89
|
+
<input type="range" class="micl-slider-m" style="--md-comp-slider-active-track-color:var(--md-sys-color-tertiary)">
|
|
90
|
+
```
|
|
91
|
+
|
|
71
92
|
## Compatibility
|
|
72
93
|
This component uses the `color-mix` CSS functional notation, which might not be supported in your browser. Please check [Browser compatibility](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/color-mix#browser_compatibility) for details.
|
|
73
94
|
|