material-inspired-component-library 3.0.2 → 4.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.
Files changed (90) hide show
  1. package/README.md +16 -14
  2. package/components/README.md +1 -1
  3. package/components/accordion/README.md +8 -3
  4. package/components/alert/README.md +76 -0
  5. package/components/alert/index.scss +121 -0
  6. package/components/appbar/README.md +9 -4
  7. package/components/appbar/index.scss +1 -1
  8. package/components/badge/README.md +8 -3
  9. package/components/badge/index.scss +1 -0
  10. package/components/bottomsheet/README.md +8 -3
  11. package/components/button/README.md +8 -3
  12. package/components/button/index.scss +7 -0
  13. package/components/card/README.md +10 -4
  14. package/components/card/index.scss +1 -1
  15. package/components/checkbox/README.md +56 -13
  16. package/components/checkbox/index.scss +148 -183
  17. package/components/checkbox/index.ts +148 -0
  18. package/components/dialog/README.md +8 -3
  19. package/components/dialog/index.scss +1 -0
  20. package/components/divider/README.md +8 -3
  21. package/components/iconbutton/README.md +8 -3
  22. package/components/iconbutton/index.scss +3 -1
  23. package/components/list/README.md +8 -3
  24. package/components/list/index.scss +2 -0
  25. package/components/list/index.ts +2 -3
  26. package/components/menu/README.md +7 -2
  27. package/components/menu/index.ts +2 -2
  28. package/components/navigationrail/README.md +8 -3
  29. package/components/navigationrail/index.scss +1 -0
  30. package/components/radio/README.md +8 -3
  31. package/components/radio/index.scss +8 -24
  32. package/components/select/README.md +3 -3
  33. package/components/sidesheet/README.md +8 -3
  34. package/components/slider/README.md +8 -3
  35. package/components/slider/index.scss +1 -0
  36. package/components/slider/index.ts +9 -10
  37. package/components/stepper/README.md +190 -0
  38. package/components/stepper/index.scss +93 -14
  39. package/components/stepper/index.ts +169 -88
  40. package/components/switch/README.md +8 -3
  41. package/components/switch/index.scss +2 -0
  42. package/components/textfield/README.md +8 -3
  43. package/components/textfield/index.ts +8 -41
  44. package/dist/alert.css +1 -0
  45. package/dist/alert.js +1 -0
  46. package/dist/badge.css +1 -1
  47. package/dist/button.css +1 -1
  48. package/dist/card.css +1 -1
  49. package/dist/checkbox.css +1 -1
  50. package/dist/components/checkbox/index.d.ts +5 -0
  51. package/dist/components/textfield/index.d.ts +0 -1
  52. package/dist/dialog.css +1 -1
  53. package/dist/foundations/form/index.d.ts +5 -0
  54. package/dist/iconbutton.css +1 -1
  55. package/dist/list.css +1 -1
  56. package/dist/micl.css +1 -1
  57. package/dist/micl.js +1 -1
  58. package/dist/navigationrail.css +1 -1
  59. package/dist/radio.css +1 -1
  60. package/dist/slider.css +1 -1
  61. package/dist/stepper.css +1 -1
  62. package/dist/switch.css +1 -1
  63. package/docs/accordion.html +1 -1
  64. package/docs/alert.html +176 -0
  65. package/docs/bottomsheet.html +2 -2
  66. package/docs/button.html +2 -2
  67. package/docs/card.html +7 -7
  68. package/docs/checkbox.html +33 -9
  69. package/docs/dialog.html +2 -2
  70. package/docs/divider.html +8 -8
  71. package/docs/iconbutton.html +2 -2
  72. package/docs/index.html +43 -32
  73. package/docs/list.html +2 -2
  74. package/docs/menu.html +2 -2
  75. package/docs/micl.css +1 -1
  76. package/docs/micl.js +1 -1
  77. package/docs/radio.html +2 -2
  78. package/docs/select.html +2 -2
  79. package/docs/sidesheet.html +2 -2
  80. package/docs/slider.html +2 -2
  81. package/docs/stepper.html +318 -0
  82. package/docs/switch.html +8 -4
  83. package/docs/textfield.html +2 -2
  84. package/foundations/form/index.ts +174 -0
  85. package/{layout → foundations/layout}/README.md +5 -0
  86. package/{layout → foundations/layout}/index.scss +1 -1
  87. package/micl.ts +3 -3
  88. package/package.json +3 -1
  89. package/styles.scss +2 -1
  90. package/webpack.config.js +1 -1
@@ -1,5 +1,5 @@
1
1
  # List
2
- This component implements the the [Material Design 3 Expressive List](https://m3.material.io/components/lists/overview) design. Lists are continuous, vertical groups of text or images, representing a set of data.
2
+ This component implements the [Material Design 3 Expressive List](https://m3.material.io/components/lists/overview) design. Lists are continuous, vertical groups of text or images, representing a set of data.
3
3
 
4
4
  ## Basic Usage
5
5
 
@@ -27,6 +27,11 @@ Import the list styles into your project:
27
27
  @use "material-inspired-component-library/dist/list";
28
28
  ```
29
29
 
30
+ Or import all MICL styles:
31
+ ```CSS
32
+ @use "material-inspired-component-library/styles";
33
+ ```
34
+
30
35
  ### JavaScript
31
36
  This component requires JavaScript to support keyboard navigation:
32
37
 
@@ -36,8 +41,8 @@ import micl from "material-inspired-component-library/dist/micl";
36
41
 
37
42
  This will initialize any List component, including those that will be added to the DOM later on.
38
43
 
39
- ### Demo
40
- A live example of the [List component](https://henkpb.github.io/micl/list.html) is available for you to interact with.
44
+ ### Live Demo
45
+ A live example of the [List component](https://henkpb.github.io/micl/list.html) is available to interact with.
41
46
 
42
47
  ## Variants
43
48
  The List component offers three CSS classes to control the height and content capacity of individual list items:
@@ -19,6 +19,7 @@
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/layout';
22
23
  @use '../../styles/motion';
23
24
  @use '../../styles/shapes';
24
25
  @use '../../styles/statelayer';
@@ -63,6 +64,7 @@
63
64
  &> summary.micl-list-item-two,
64
65
  &> summary.micl-list-item-three {
65
66
  position: relative;
67
+ -webkit-tap-highlight-color: transparent;
66
68
 
67
69
  &::-webkit-details-marker {
68
70
  display: none;
@@ -23,9 +23,8 @@ export const listSelector = '.micl-list-item-one,.micl-list-item-two,.micl-list-
23
23
 
24
24
  export default (() =>
25
25
  {
26
- const
27
- isDisabled = (item: HTMLElement | null): boolean => !!item && item.classList.contains('micl-list-item--disabled'),
28
- isSelected = (item: HTMLElement | null): boolean => !!item && item.matches(':has(input[type=checkbox]:checked)');
26
+ const isDisabled = (item: HTMLElement | null): boolean => !!item && item.classList.contains('micl-list-item--disabled');
27
+ const isSelected = (item: HTMLElement | null): boolean => !!item && item.matches(':has(input[type=checkbox]:checked)');
29
28
 
30
29
  return {
31
30
  keydown: (event: Event) =>
@@ -28,6 +28,11 @@ Import the styles for both the menu and list components into your project:
28
28
  @use "material-inspired-component-library/dist/menu";
29
29
  ```
30
30
 
31
+ Or import all MICL styles:
32
+ ```CSS
33
+ @use "material-inspired-component-library/styles";
34
+ ```
35
+
31
36
  ### JavaScript
32
37
  This component requires JavaScript for functionality:
33
38
 
@@ -37,8 +42,8 @@ import micl from "material-inspired-component-library/dist/micl";
37
42
 
38
43
  This will initialize any Menu component, including those that will be added to the DOM later on.
39
44
 
40
- ### Demo
41
- A live example of the [Menu component](https://henkpb.github.io/micl/menu.html) is available for you to interact with.
45
+ ### Live Demo
46
+ A live example of the [Menu component](https://henkpb.github.io/micl/menu.html) is available to interact with.
42
47
 
43
48
  ## Variants
44
49
  Since the Menu component is based on the **List component**, all of its list item variants and content features can be used. You can incorporate icons, avatars, images, multiple lines of text, and more.
@@ -25,8 +25,8 @@ export default (() =>
25
25
  {
26
26
  const getOrigin = (invoker: Element, popover: Element): string =>
27
27
  {
28
- const invokerRect = invoker.getBoundingClientRect(),
29
- popoverRect = popover.getBoundingClientRect();
28
+ const invokerRect = invoker.getBoundingClientRect();
29
+ const popoverRect = popover.getBoundingClientRect();
30
30
 
31
31
  return ((invokerRect.x > popoverRect.x) ? 'right ' : 'left ') +
32
32
  ((invokerRect.y > popoverRect.y) ? 'bottom' : 'top');
@@ -1,5 +1,5 @@
1
1
  # Navigation rail
2
- This component implements the the [Material Design 3 Expressive Navigation rail](https://m3.material.io/components/navigation-rail/overview) design.
2
+ This component implements the [Material Design 3 Expressive Navigation rail](https://m3.material.io/components/navigation-rail/overview) design.
3
3
 
4
4
  ## Basic Usage
5
5
 
@@ -30,6 +30,11 @@ Import the navigation rail styles into your project:
30
30
  @use "material-inspired-component-library/dist/navigationrail";
31
31
  ```
32
32
 
33
+ Or import all MICL styles:
34
+ ```CSS
35
+ @use "material-inspired-component-library/styles";
36
+ ```
37
+
33
38
  ### JavaScript
34
39
  This component requires JavaScript to support keyboard navigation. The library will automatically initialize new components as they're added to the DOM.
35
40
 
@@ -37,8 +42,8 @@ This component requires JavaScript to support keyboard navigation. The library w
37
42
  import micl from "material-inspired-component-library/dist/micl";
38
43
  ```
39
44
 
40
- ### Demo
41
- A live example of the [Navigation rail component](https://henkpb.github.io/micl/navigationrail.html) is available for you to interact with.
45
+ ### Live Demo
46
+ A live example of the [Navigation rail component](https://henkpb.github.io/micl/navigationrail.html) is available to interact with.
42
47
 
43
48
  ## Variants
44
49
  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.
@@ -19,6 +19,7 @@
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/layout';
22
23
  @use '../../styles/elevation';
23
24
  @use '../../styles/motion';
24
25
  @use '../../styles/shapes';
@@ -1,5 +1,5 @@
1
1
  # Radio button
2
- This component implements the the [Material Design 3 Expressive Radio button](https://m3.material.io/components/radio-button/overview) design. A radio button allows a user to select only one option from a group of mutually exclusive choices.
2
+ This component implements the [Material Design 3 Expressive Radio button](https://m3.material.io/components/radio-button/overview) design. A radio button allows a user to select only one option from a group of mutually exclusive choices.
3
3
 
4
4
  ## Basic Usage
5
5
 
@@ -18,11 +18,16 @@ Import the radio button styles into your project:
18
18
  @use "material-inspired-component-library/dist/radio";
19
19
  ```
20
20
 
21
+ Or import all MICL styles:
22
+ ```CSS
23
+ @use "material-inspired-component-library/styles";
24
+ ```
25
+
21
26
  ### JavaScript
22
27
  No custom JavaScript is required for the core functionality of this component.
23
28
 
24
- ### Demo
25
- A live example of the [Radio button component](https://henkpb.github.io/micl/radio.html) is available for you to interact with.
29
+ ### Live Demo
30
+ A live example of the [Radio button component](https://henkpb.github.io/micl/radio.html) is available to interact with.
26
31
 
27
32
  ## Variants
28
33
  A radio button can be disabled by adding the `disabled` attribute to the `<input>` element.
@@ -45,6 +45,7 @@ input[type=radio].micl-radio {
45
45
  border: calc((var(--md-sys-target-size) - var(--md-sys-radio-state-layer-size)) / 2) solid transparent;
46
46
  background-clip: content-box;
47
47
  background-color: transparent;
48
+ -webkit-tap-highlight-color: transparent;
48
49
  border-radius: var(--md-sys-shape-corner-full);
49
50
  outline-offset: -7px;
50
51
 
@@ -85,9 +86,10 @@ input[type=radio].micl-radio {
85
86
  background-size 3000ms,
86
87
  --statelayer-opacity var(--md-sys-radio-motion-duration) linear;
87
88
 
88
- &:hover {
89
+ &:hover,
90
+ &:focus-visible,
91
+ &:active {
89
92
  --statelayer-color: var(--md-sys-color-on-surface);
90
- --statelayer-opacity: var(--md-sys-state-hover-state-layer-opacity);
91
93
 
92
94
  &:checked {
93
95
  --statelayer-color: var(--md-sys-color-primary);
@@ -99,38 +101,19 @@ input[type=radio].micl-radio {
99
101
  border-color: var(--md-sys-color-primary);
100
102
  }
101
103
  }
104
+ &:hover {
105
+ --statelayer-opacity: var(--md-sys-state-hover-state-layer-opacity);
106
+ }
102
107
  &:focus-visible {
103
- --statelayer-color: var(--md-sys-color-on-surface);
104
108
  --statelayer-opacity: var(--md-sys-state-focus-state-layer-opacity);
105
109
 
106
110
  outline: var(--md-sys-state-focus-indicator-thickness) solid var(--md-sys-color-secondary);
107
-
108
- &:checked {
109
- --statelayer-color: var(--md-sys-color-primary);
110
- }
111
- &::after {
112
- border-color: var(--md-sys-color-on-surface);
113
- }
114
- &:checked::after {
115
- border-color: var(--md-sys-color-primary);
116
- }
117
111
  }
118
112
  &:active {
119
- --statelayer-color: var(--md-sys-color-on-surface);
120
113
  --statelayer-opacity: var(--md-sys-state-pressed-state-layer-opacity);
121
114
 
122
115
  background-size: 0%, 100%;
123
116
  transition: background-size 0ms;
124
-
125
- &:checked {
126
- --statelayer-color: var(--md-sys-color-primary);
127
- }
128
- &::after {
129
- border-color: var(--md-sys-color-on-surface);
130
- }
131
- &:checked::after {
132
- border-color: var(--md-sys-color-primary);
133
- }
134
117
  }
135
118
  }
136
119
  &:disabled {
@@ -147,6 +130,7 @@ input[type=radio].micl-radio {
147
130
 
148
131
  input[type=radio].micl-radio:not(:disabled) + label,
149
132
  label:has(+ input[type=radio].micl-radio:not(:disabled)) {
133
+ -webkit-tap-highlight-color: transparent;
150
134
  cursor: pointer;
151
135
  }
152
136
  input[type=radio].micl-radio + label,
@@ -1,5 +1,5 @@
1
1
  # Select
2
- This component implements the the [Material Design 3 Expressive Select](https://m3.material.io/components/menus/guidelines#ee2f3664-c926-47ab-acbf-2ab675506932) design. A select component is used to offer the user with a set of options from which the user can select a single one.
2
+ This component implements the [Material Design 3 Expressive Select](https://m3.material.io/components/menus/guidelines#ee2f3664-c926-47ab-acbf-2ab675506932) design. A select component is used to offer the user with a set of options from which the user can select a single one.
3
3
 
4
4
  ## Basic Usage
5
5
 
@@ -38,8 +38,8 @@ import micl from "material-inspired-component-library/dist/micl";
38
38
 
39
39
  This will initialize any Select component, including those that will be added to the DOM later on.
40
40
 
41
- ### Demo
42
- A live example of the [Select component](https://henkpb.github.io/micl/select.html) is available for you to interact with.
41
+ ### Live Demo
42
+ A live example of the [Select component](https://henkpb.github.io/micl/select.html) is available to interact with.
43
43
 
44
44
  ## Variants
45
45
  A Select Component can be disabled by adding the `disabled` attribute to the `<select>` element. An option within the component can be disabled by adding the `disabled` attribute to the `<option>` element.
@@ -1,5 +1,5 @@
1
1
  # Side sheet
2
- This component implements the the [Material Design 3 Expressive Side sheet](https://m3.material.io/components/side-sheets/overview) design. Side sheets provide optional content and actions without interrupting the main content.
2
+ This component implements the [Material Design 3 Expressive Side sheet](https://m3.material.io/components/side-sheets/overview) design. Side sheets provide optional content and actions without interrupting the main content.
3
3
 
4
4
  ## Basic Usage
5
5
 
@@ -29,11 +29,16 @@ Import the side sheet styles into your project:
29
29
  @use "material-inspired-component-library/dist/sidesheet";
30
30
  ```
31
31
 
32
+ Or import all MICL styles:
33
+ ```CSS
34
+ @use "material-inspired-component-library/styles";
35
+ ```
36
+
32
37
  ### JavaScript
33
38
  No custom JavaScript is required for the core functionality of the side sheet component.
34
39
 
35
- ### Demo
36
- A live example of the [Side sheet component](https://henkpb.github.io/micl/sidesheet.html) is available for you to interact with.
40
+ ### Live Demo
41
+ A live example of the [Side sheet component](https://henkpb.github.io/micl/sidesheet.html) is available to interact with.
37
42
 
38
43
  ## Variants
39
44
  A **modal** side sheet blocks access to the rest of the page and must be dismissed explicitly by the user. This is suitable for critical tasks or information that requires a user's full attention.
@@ -1,5 +1,5 @@
1
1
  # Slider
2
- This component implements the the [Material Design 3 Expressive Slider](https://m3.material.io/components/sliders/overview) design.
2
+ This component implements the [Material Design 3 Expressive Slider](https://m3.material.io/components/sliders/overview) design.
3
3
 
4
4
  ## Basic Usage
5
5
 
@@ -17,6 +17,11 @@ Import the slider styles into your project:
17
17
  @use "material-inspired-component-library/dist/slider";
18
18
  ```
19
19
 
20
+ Or import all MICL styles:
21
+ ```CSS
22
+ @use "material-inspired-component-library/styles";
23
+ ```
24
+
20
25
  ### JavaScript
21
26
  This component requires JavaScript for functionality:
22
27
 
@@ -26,8 +31,8 @@ import micl from "material-inspired-component-library/dist/micl";
26
31
 
27
32
  This will initialize any Slider component, including those that will be added to the DOM later on.
28
33
 
29
- ### Demo
30
- A live example of the [Slider component](https://henkpb.github.io/micl/slider.html) is available for you to interact with.
34
+ ### Live Demo
35
+ A live example of the [Slider component](https://henkpb.github.io/micl/slider.html) is available to interact with.
31
36
 
32
37
  ## Variants
33
38
  Sliders come in **five different sizes**: extra small (`xs`), small (`s`), medium (`m`), large (`l`), and extra large (`xl`). To set a specific size, append the appropriate postfix to the `micl-slider` CSS class name:
@@ -19,6 +19,7 @@
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/layout';
22
23
  @use '../../styles/motion';
23
24
  @use '../../styles/shapes';
24
25
  @use '../../styles/statelayer';
@@ -97,18 +97,17 @@ export default (() =>
97
97
  setValue(element);
98
98
  setVars(element);
99
99
 
100
- const
101
- max = parseFloat(element.max),
102
- min = parseFloat(element.min),
103
- rect = element.getBoundingClientRect(),
104
- percentages = getTickValues(element, max, min).sort((a, b) => a - b).map(value => {
105
- return Math.round(100 * (value - min) / (max - min));
106
- });
100
+ const max = parseFloat(element.max);
101
+ const min = parseFloat(element.min);
102
+ const rect = element.getBoundingClientRect();
103
+ const percentages = getTickValues(element, max, min).sort((a, b) => a - b).map(value => {
104
+ return Math.round(100 * (value - min) / (max - min));
105
+ });
107
106
 
108
107
  if (percentages.length > 0) {
109
- const
110
- canvas = document.createElement('canvas'),
111
- ctx = canvas.getContext('2d');
108
+ const canvas = document.createElement('canvas');
109
+ const ctx = canvas.getContext('2d');
110
+
112
111
  if (ctx) {
113
112
  ctx.font = window.getComputedStyle(element).getPropertyValue('font');
114
113
  let blankWidth = ctx.measureText(blank).width,
@@ -0,0 +1,190 @@
1
+ # Stepper
2
+ This component creates a **Stepper** to manage a linear, step-by-step process for gathering or displaying information, inspired by the design principles of [Material Design 3 Expressive](https://m3.material.io/components).
3
+
4
+ ## Basic Usage
5
+
6
+ ### HTML
7
+ To create a basic stepper, use a `<div>` container with the `micl-stepper` class and the `role="tablist"` attribute. The individual steps are placed within `<div class="micl-stepper__steps">`. Each step content is a `<div>` with the `micl-stepper__step` class and the `role="tabpanel"` attribute. The currently active step must be marked with `aria-current="step"`.
8
+
9
+ ```HTML
10
+ <div class="micl-stepper" role="tablist" aria-label="My Step-by-Step Process">
11
+ <div class="micl-stepper__steps">
12
+ <div class="micl-stepper__step" role="tabpanel" aria-current="step">
13
+ Step 1 Content
14
+ </div>
15
+ <div class="micl-stepper__step" role="tabpanel">
16
+ Step 2 Content
17
+ </div>
18
+ </div>
19
+
20
+ <div class="micl-stepper__actions">
21
+ <div>
22
+ <button type="button" class="micl-button-text-m micl-stepper__action-back">Back</button>
23
+ </div>
24
+ <div>
25
+ <button type="button" class="micl-button-tonal-m micl-stepper__action-next">Next</button>
26
+ </div>
27
+ </div>
28
+ </div>
29
+ ```
30
+
31
+ ### CSS
32
+ Import the stepper styles into your project:
33
+
34
+ ```CSS
35
+ @use "material-inspired-component-library/dist/stepper";
36
+ ```
37
+
38
+ Or import all MICL styles:
39
+ ```CSS
40
+ @use "material-inspired-component-library/styles";
41
+ ```
42
+
43
+ ### JavaScript
44
+ This component requires JavaScript to enable navigation, state management, and form validation. The library will automatically initialize new components as they're added to the DOM.
45
+
46
+ ```JavaScript
47
+ import micl from "material-inspired-component-library/dist/micl";
48
+ ```
49
+
50
+ ### Live Demo
51
+ A live example of the [Stepper component](https://henkpb.github.io/micl/stepper.html) is available to interact with.
52
+
53
+ ## Action and State Management
54
+ The Stepper component automatically manages navigation between steps and controls the visibility of the **Back** and **Next** buttons based on the current step.
55
+
56
+ - **Next Action**: Clicking a button with the `micl-stepper__action-next` class advances the stepper by one step. This button is automatically hidden when the last step is active.
57
+
58
+ - **Back Action**: Clicking a button with the `micl-stepper__action-back` class moves the stepper back one step. This button is automatically hidden when the first step is active.
59
+
60
+ ### Stepper Header
61
+ The optional Stepper Header displays the step titles horizontally, allowing users to navigate directly to steps. The `aria-controls` and `aria-labelledby` attributes are essential for accessibility, linking the header buttons to their corresponding step panels.
62
+
63
+ ```HTML
64
+ <div class="micl-stepper">
65
+ <div class="micl-stepper__header">
66
+ <button type="button" role="tab" id="step1Label class="micl-button-text-xs" aria-controls="step1" aria-selected="true">
67
+ <span class="micl-stepper__progress-dot" aria-hidden="true"></span>
68
+ Step 1
69
+ </button>
70
+ <button type="button" role="tab" id="step2Label class="micl-button-text-xs" aria-controls="step2">
71
+ <span class="micl-stepper__progress-dot" aria-hidden="true"></span>
72
+ Step 2
73
+ </button>
74
+ </div>
75
+ <div class="micl-stepper__steps">
76
+ <div id="step1" role="tabpanel" class="micl-stepper__step" aria-labelledby="step1Label" aria-current="step">
77
+ Step 1 Content
78
+ </div>
79
+ <div id="step2" role="tabpanel" class="micl-stepper__step" aria-labelledby="step2Label">
80
+ Step 2 Content
81
+ </div>
82
+ </div>
83
+ </div>
84
+ ```
85
+
86
+ ### Linear vs. Non-linear Steppers
87
+ - **Linear (Default)**: The user can only click the header buttons of previous steps to revisit them. Navigation to future steps is disabled until they are reached.
88
+
89
+ - **Non-linear**: Apply the `micl-stepper--nonlinear` modifier class to the main stepper container. This allows the user to click any of the header buttons to freely jump between steps.
90
+
91
+ ## Variants
92
+
93
+ ### Progress indicator
94
+ You can include optional elements to display the user's progress.
95
+
96
+ #### Counter
97
+ Use the `micl-stepper__progress-current` and `micl-stepper__progress-total` classes to automatically display the current step number and the total number of steps (e.g., "1 of 3").
98
+
99
+ ```HTML
100
+ <div class="micl-stepper__actions">
101
+ <div>
102
+ <button type="button" class="micl-button-text-m micl-stepper__action-back">Back</button>
103
+ </div>
104
+ <div>
105
+ <span class="micl-stepper__progress-current"></span>
106
+ <span> of </span>
107
+ <span class="micl-stepper__progress-total"></span>
108
+ </div>
109
+ <div>
110
+ <button type="button" class="micl-button-tonal-m micl-stepper__action-next">Next</button>
111
+ </div>
112
+ </div>
113
+ ```
114
+
115
+ #### Dots
116
+ Use the `micl-stepper__progress-dots` class to generate a visual progress bar using colored dots. The dots dynamically change color to indicate the current step.
117
+
118
+ ```HTML
119
+ <div class="micl-stepper__actions">
120
+ <div>
121
+ <button type="button" class="micl-button-text-m micl-stepper__action-back">Back</button>
122
+ </div>
123
+ <div class="micl-stepper__progress-dots"></div>
124
+ <div>
125
+ <button type="button" class="micl-button-tonal-m micl-stepper__action-next">Next</button>
126
+ </div>
127
+ </div>
128
+ ```
129
+
130
+ ### Step validation
131
+ To enable built-in **form validation** for each step, use a `<form>` element as the main stepper container and replace the step `<div>`s with `<fieldset>` elements.
132
+
133
+ #### Validation Flow
134
+ - **Step-by-Step Validation**: When a user clicks **Next**, the browser's built-in validation is triggered only for the input fields within the current step. If any constraints are violated, the stepper will not advance.
135
+
136
+ - **Error Display**: The Stepper component applies the error state to any child MICL component that supports it, displaying the custom error text. Otherwise, the default browser validation message appears.
137
+
138
+ - **Final Submission Validation**: If the final step contains a `type="submit"` button, the component validates the entire form upon submission. The form will only be submitted if all data input fields across all steps are valid.
139
+
140
+ ```HTML
141
+ <form class="micl-stepper" action="/submit-data" method="post" role="tablist" aria-label="My Form">
142
+ <div class="micl-stepper__steps">
143
+ <fieldset class="micl-stepper__step" role="tabpanel" aria-current="step">
144
+ <div class="micl-textfield-filled">
145
+ <label for="mytextfield">Label text</label>
146
+ <input type="text" id="mytextfield" name="mytext" required>
147
+ </div>
148
+ </fieldset>
149
+ <fieldset class="micl-stepper__step" role="tabpanel">
150
+ Step 2 Content
151
+ </fieldset>
152
+ </div>
153
+ <div class="micl-stepper__actions">
154
+ ...
155
+ </div>
156
+ </form>
157
+ ```
158
+
159
+ #### Step-Specific Action Buttons
160
+ Action buttons can be made visible only on a specific step by using the `data-step` attribute, which specifies the step number (starting from 1). This is useful for replacing the default **Next** button with a content-specific action, like a **Submit** button on the final step.
161
+
162
+ In this example for a three-step stepper, the **Next** button is hidden on step 3, and the **Submit** button is shown instead:
163
+
164
+ ```HTML
165
+ <div class="micl-stepper__actions">
166
+ <div>
167
+ <button type="button" class="micl-button-text-m micl-stepper__action-back">Back</button>
168
+ </div>
169
+ <div>
170
+ <button type="submit" class="micl-button-tonal-m" data-step="3">Submit</button>
171
+ <button type="button" class="micl-button-tonal-m micl-stepper__action-next">Next</button>
172
+ </div>
173
+ </div>
174
+ ```
175
+
176
+ ## Customizations
177
+ You can customize the appearance of the Stepper 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 steppers.
178
+
179
+ | Variable name | Default Value | Description |
180
+ | ------------- | ----- | ----------- |
181
+ | --md-sys-stepper-counter-style | decimal | The list-style used for the counter number inside the dots in the stepper header |
182
+ | --md-sys-stepper-dot-size | 12px | Controls the size of each progress dot |
183
+
184
+ **Example: Changing the style of the counter inside header dots**
185
+
186
+ ```HTML
187
+ <div class="micl-stepper" style="--md-sys-stepper-counter-style:upper-alpha">
188
+ ...
189
+ </div>
190
+ ```