@digicreon/mucss 1.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/LICENSE +21 -0
- package/README.md +145 -0
- package/dist/mu.amber.css +2 -0
- package/dist/mu.azure.css +2 -0
- package/dist/mu.blue.css +2 -0
- package/dist/mu.css +2 -0
- package/dist/mu.cyan.css +2 -0
- package/dist/mu.fuchsia.css +2 -0
- package/dist/mu.green.css +2 -0
- package/dist/mu.grey.css +2 -0
- package/dist/mu.indigo.css +2 -0
- package/dist/mu.jade.css +2 -0
- package/dist/mu.lime.css +2 -0
- package/dist/mu.orange.css +2 -0
- package/dist/mu.pink.css +2 -0
- package/dist/mu.pumpkin.css +2 -0
- package/dist/mu.purple.css +2 -0
- package/dist/mu.red.css +2 -0
- package/dist/mu.sand.css +2 -0
- package/dist/mu.slate.css +2 -0
- package/dist/mu.violet.css +2 -0
- package/dist/mu.yellow.css +2 -0
- package/dist/mu.zinc.css +2 -0
- package/documentation/mu.accordion.md +119 -0
- package/documentation/mu.alert.md +134 -0
- package/documentation/mu.badge.md +155 -0
- package/documentation/mu.breadcrumb.md +140 -0
- package/documentation/mu.button.md +147 -0
- package/documentation/mu.card.md +135 -0
- package/documentation/mu.checkbox-radio.md +121 -0
- package/documentation/mu.dropdown.md +183 -0
- package/documentation/mu.forms-advanced.md +164 -0
- package/documentation/mu.forms.md +147 -0
- package/documentation/mu.grid.md +175 -0
- package/documentation/mu.group.md +102 -0
- package/documentation/mu.loading.md +99 -0
- package/documentation/mu.modal.md +163 -0
- package/documentation/mu.pagination.md +196 -0
- package/documentation/mu.progress.md +123 -0
- package/documentation/mu.range.md +103 -0
- package/documentation/mu.spinner.md +102 -0
- package/documentation/mu.switch.md +110 -0
- package/documentation/mu.table.md +147 -0
- package/documentation/mu.tabs.md +164 -0
- package/documentation/mu.tooltip.md +98 -0
- package/documentation/mu.typography.md +196 -0
- package/package.json +31 -0
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
# µPagination
|
|
2
|
+
|
|
3
|
+
**µPagination** is a flexible page navigation component, part of the [µCSS](.) framework. It supports alignment variants, sizes, responsive behavior, and borderless styling.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
Pagination uses a `<nav>` containing a `<ul>` with the `.pagination` class. Each page is a `<li>` with an `<a>` or `<span>` inside.
|
|
10
|
+
|
|
11
|
+
```html
|
|
12
|
+
<nav aria-label="Pagination">
|
|
13
|
+
<ul class="pagination">
|
|
14
|
+
<li class="pagination-prev"><a href="#">« Prev</a></li>
|
|
15
|
+
<li><a href="#">1</a></li>
|
|
16
|
+
<li class="active"><a href="#" aria-current="page">2</a></li>
|
|
17
|
+
<li><a href="#">3</a></li>
|
|
18
|
+
<li><a href="#">4</a></li>
|
|
19
|
+
<li><a href="#">5</a></li>
|
|
20
|
+
<li class="pagination-next"><a href="#">Next »</a></li>
|
|
21
|
+
</ul>
|
|
22
|
+
</nav>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Item states
|
|
28
|
+
|
|
29
|
+
### Active page
|
|
30
|
+
|
|
31
|
+
Add `.active` to the `<li>` to indicate the current page. The active item gets the primary color as background and disables pointer events.
|
|
32
|
+
|
|
33
|
+
```html
|
|
34
|
+
<li class="active"><a href="#" aria-current="page">2</a></li>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Disabled
|
|
38
|
+
|
|
39
|
+
Add `.disabled` to the `<li>` to disable an item (e.g., the "Prev" button on the first page). The item is faded and non-interactive.
|
|
40
|
+
|
|
41
|
+
```html
|
|
42
|
+
<li class="pagination-prev disabled"><a href="#">« Prev</a></li>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Ellipsis
|
|
46
|
+
|
|
47
|
+
Use `.pagination-ellipsis` with a `<span>` to indicate skipped page numbers:
|
|
48
|
+
|
|
49
|
+
```html
|
|
50
|
+
<li class="pagination-ellipsis"><span>…</span></li>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### With ellipsis and disabled
|
|
54
|
+
|
|
55
|
+
```html
|
|
56
|
+
<nav aria-label="Pagination">
|
|
57
|
+
<ul class="pagination">
|
|
58
|
+
<li class="pagination-prev disabled"><a href="#">« Prev</a></li>
|
|
59
|
+
<li class="active"><a href="#" aria-current="page">1</a></li>
|
|
60
|
+
<li><a href="#">2</a></li>
|
|
61
|
+
<li><a href="#">3</a></li>
|
|
62
|
+
<li class="pagination-ellipsis"><span>…</span></li>
|
|
63
|
+
<li><a href="#">20</a></li>
|
|
64
|
+
<li class="pagination-next"><a href="#">Next »</a></li>
|
|
65
|
+
</ul>
|
|
66
|
+
</nav>
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Alignment
|
|
72
|
+
|
|
73
|
+
By default, pagination is left-aligned. Two modifier classes change the alignment:
|
|
74
|
+
|
|
75
|
+
| Class | Effect |
|
|
76
|
+
|------------------------|---------------------------|
|
|
77
|
+
| `.pagination-centered` | `justify-content: center` |
|
|
78
|
+
| `.pagination-end` | `justify-content: flex-end` |
|
|
79
|
+
|
|
80
|
+
### Centered
|
|
81
|
+
|
|
82
|
+
```html
|
|
83
|
+
<nav aria-label="Pagination">
|
|
84
|
+
<ul class="pagination pagination-centered">
|
|
85
|
+
<li class="pagination-prev"><a href="#">«</a></li>
|
|
86
|
+
<li><a href="#">1</a></li>
|
|
87
|
+
<li class="active"><a href="#" aria-current="page">2</a></li>
|
|
88
|
+
<li><a href="#">3</a></li>
|
|
89
|
+
<li class="pagination-next"><a href="#">»</a></li>
|
|
90
|
+
</ul>
|
|
91
|
+
</nav>
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### End-aligned
|
|
95
|
+
|
|
96
|
+
```html
|
|
97
|
+
<nav aria-label="Pagination">
|
|
98
|
+
<ul class="pagination pagination-end">
|
|
99
|
+
<li class="pagination-prev"><a href="#">«</a></li>
|
|
100
|
+
<li><a href="#">1</a></li>
|
|
101
|
+
<li class="active"><a href="#" aria-current="page">2</a></li>
|
|
102
|
+
<li><a href="#">3</a></li>
|
|
103
|
+
<li class="pagination-next"><a href="#">»</a></li>
|
|
104
|
+
</ul>
|
|
105
|
+
</nav>
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## Sizes
|
|
111
|
+
|
|
112
|
+
Two size variants adjust the dimensions, padding, and font size of pagination items:
|
|
113
|
+
|
|
114
|
+
| Class | Min-width | Height | Padding | Font size |
|
|
115
|
+
|-------------------|-----------|----------|----------------------|------------|
|
|
116
|
+
| `.pagination-sm` | 1.75rem | 1.75rem | `0.15rem 0.45rem` | `0.75rem` |
|
|
117
|
+
| *(default)* | 2.25rem | 2.25rem | `0.25rem 0.625rem` | `0.875rem` |
|
|
118
|
+
| `.pagination-lg` | 2.75rem | 2.75rem | `0.375rem 0.8rem` | `1rem` |
|
|
119
|
+
|
|
120
|
+
```html
|
|
121
|
+
<ul class="pagination pagination-sm">...</ul>
|
|
122
|
+
<ul class="pagination pagination-lg">...</ul>
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## Borderless
|
|
128
|
+
|
|
129
|
+
Remove borders from all pagination items:
|
|
130
|
+
|
|
131
|
+
```html
|
|
132
|
+
<nav aria-label="Pagination">
|
|
133
|
+
<ul class="pagination pagination-borderless">
|
|
134
|
+
<li class="pagination-prev"><a href="#">«</a></li>
|
|
135
|
+
<li><a href="#">1</a></li>
|
|
136
|
+
<li class="active"><a href="#" aria-current="page">2</a></li>
|
|
137
|
+
<li><a href="#">3</a></li>
|
|
138
|
+
<li><a href="#">4</a></li>
|
|
139
|
+
<li class="pagination-next"><a href="#">»</a></li>
|
|
140
|
+
</ul>
|
|
141
|
+
</nav>
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## Responsive
|
|
147
|
+
|
|
148
|
+
Add `.pagination-responsive` to hide page numbers (except the active page and prev/next controls) on screens narrower than 640px:
|
|
149
|
+
|
|
150
|
+
```html
|
|
151
|
+
<nav aria-label="Pagination">
|
|
152
|
+
<ul class="pagination pagination-responsive">
|
|
153
|
+
<li class="pagination-prev"><a href="#">« Prev</a></li>
|
|
154
|
+
<li><a href="#">1</a></li>
|
|
155
|
+
<li><a href="#">2</a></li>
|
|
156
|
+
<li class="active"><a href="#" aria-current="page">3</a></li>
|
|
157
|
+
<li><a href="#">4</a></li>
|
|
158
|
+
<li><a href="#">5</a></li>
|
|
159
|
+
<li class="pagination-next"><a href="#">Next »</a></li>
|
|
160
|
+
</ul>
|
|
161
|
+
</nav>
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
On mobile (<640px), only `.pagination-prev`, `.pagination-next`, and `.active` items are visible. The pagination stretches full width with `justify-content: space-between`.
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## CSS classes reference
|
|
169
|
+
|
|
170
|
+
| Class | Applied to | Description |
|
|
171
|
+
|------------------------|------------|--------------------------------------------------|
|
|
172
|
+
| `.pagination` | `<ul>` | Base pagination container (flex, list-style none) |
|
|
173
|
+
| `.pagination-prev` | `<li>` | Previous page item (bold text) |
|
|
174
|
+
| `.pagination-next` | `<li>` | Next page item (bold text) |
|
|
175
|
+
| `.active` | `<li>` | Current page (primary bg, non-interactive) |
|
|
176
|
+
| `.disabled` | `<li>` | Disabled item (faded, non-interactive) |
|
|
177
|
+
| `.pagination-ellipsis` | `<li>` | Ellipsis separator (no border) |
|
|
178
|
+
| `.pagination-centered` | `<ul>` | Center-aligned pagination |
|
|
179
|
+
| `.pagination-end` | `<ul>` | Right-aligned pagination |
|
|
180
|
+
| `.pagination-sm` | `<ul>` | Small size variant |
|
|
181
|
+
| `.pagination-lg` | `<ul>` | Large size variant |
|
|
182
|
+
| `.pagination-borderless` | `<ul>` | Remove borders from items |
|
|
183
|
+
| `.pagination-responsive` | `<ul>` | Hide non-essential items on mobile |
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
## Accessibility
|
|
188
|
+
|
|
189
|
+
- Wrap pagination in a `<nav>` element with `aria-label="Pagination"`.
|
|
190
|
+
- Add `aria-current="page"` to the active page link.
|
|
191
|
+
- The active page and disabled items have `pointer-events: none` to prevent interaction.
|
|
192
|
+
- Focus-visible outlines (`2px solid`) are applied for keyboard navigation.
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
→ [Voir l'exemple](../examples/pagination.html)
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# µProgress
|
|
2
|
+
|
|
3
|
+
**µProgress** adds 8 color variants to the native `<progress>` element, part of the [µCSS](.) framework. It uses `accent-color` and vendor-specific pseudo-elements for cross-browser compatibility.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
Apply a color class directly on a `<progress>` element to change the bar color. Without a color class, the default PicoCSS progress styling applies.
|
|
10
|
+
|
|
11
|
+
```html
|
|
12
|
+
<progress class="progress-primary" value="75" max="100">75%</progress>
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
The text content inside `<progress>` serves as a fallback for browsers that do not support the element.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Color variants
|
|
20
|
+
|
|
21
|
+
8 color classes are available, matching the µCSS color roles:
|
|
22
|
+
|
|
23
|
+
| Class | Color variable |
|
|
24
|
+
|----------------------|----------------------|
|
|
25
|
+
| `.progress-primary` | `--pico-primary` |
|
|
26
|
+
| `.progress-secondary`| `--pico-secondary` |
|
|
27
|
+
| `.progress-tertiary` | `--pico-tertiary` |
|
|
28
|
+
| `.progress-contrast` | `--pico-contrast` |
|
|
29
|
+
| `.progress-success` | `--pico-success` |
|
|
30
|
+
| `.progress-info` | `--pico-info` |
|
|
31
|
+
| `.progress-warning` | `--pico-warning` |
|
|
32
|
+
| `.progress-error` | `--pico-error` |
|
|
33
|
+
|
|
34
|
+
### All 8 variants
|
|
35
|
+
|
|
36
|
+
```html
|
|
37
|
+
<label>Primary (75%)
|
|
38
|
+
<progress class="progress-primary" value="75" max="100">75%</progress>
|
|
39
|
+
</label>
|
|
40
|
+
<label>Secondary (60%)
|
|
41
|
+
<progress class="progress-secondary" value="60" max="100">60%</progress>
|
|
42
|
+
</label>
|
|
43
|
+
<label>Tertiary (45%)
|
|
44
|
+
<progress class="progress-tertiary" value="45" max="100">45%</progress>
|
|
45
|
+
</label>
|
|
46
|
+
<label>Contrast (90%)
|
|
47
|
+
<progress class="progress-contrast" value="90" max="100">90%</progress>
|
|
48
|
+
</label>
|
|
49
|
+
<label>Success (80%)
|
|
50
|
+
<progress class="progress-success" value="80" max="100">80%</progress>
|
|
51
|
+
</label>
|
|
52
|
+
<label>Info (50%)
|
|
53
|
+
<progress class="progress-info" value="50" max="100">50%</progress>
|
|
54
|
+
</label>
|
|
55
|
+
<label>Warning (35%)
|
|
56
|
+
<progress class="progress-warning" value="35" max="100">35%</progress>
|
|
57
|
+
</label>
|
|
58
|
+
<label>Error (20%)
|
|
59
|
+
<progress class="progress-error" value="20" max="100">20%</progress>
|
|
60
|
+
</label>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Various values
|
|
66
|
+
|
|
67
|
+
The `value` attribute controls the fill level. Set `max` to define the scale (typically 100).
|
|
68
|
+
|
|
69
|
+
```html
|
|
70
|
+
<progress class="progress-primary" value="0" max="100">0%</progress>
|
|
71
|
+
<progress class="progress-success" value="25" max="100">25%</progress>
|
|
72
|
+
<progress class="progress-info" value="50" max="100">50%</progress>
|
|
73
|
+
<progress class="progress-primary" value="100" max="100">100%</progress>
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## Indeterminate
|
|
79
|
+
|
|
80
|
+
Omit the `value` attribute to create an indeterminate progress bar (animated loading indicator):
|
|
81
|
+
|
|
82
|
+
```html
|
|
83
|
+
<progress class="progress-primary">Loading...</progress>
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## Cross-browser implementation
|
|
89
|
+
|
|
90
|
+
Each color variant sets three properties for full browser support:
|
|
91
|
+
|
|
92
|
+
| Property | Target |
|
|
93
|
+
|---------------------------------|------------------|
|
|
94
|
+
| `accent-color` | Modern browsers |
|
|
95
|
+
| `::-webkit-progress-value` | Chrome, Safari |
|
|
96
|
+
| `::-moz-progress-bar` | Firefox |
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## CSS classes reference
|
|
101
|
+
|
|
102
|
+
| Class | Description |
|
|
103
|
+
|----------------------|--------------------------------------|
|
|
104
|
+
| `.progress-primary` | Primary color progress bar |
|
|
105
|
+
| `.progress-secondary`| Secondary color progress bar |
|
|
106
|
+
| `.progress-tertiary` | Tertiary color progress bar |
|
|
107
|
+
| `.progress-contrast` | Contrast color progress bar |
|
|
108
|
+
| `.progress-success` | Success (green) progress bar |
|
|
109
|
+
| `.progress-info` | Info (blue) progress bar |
|
|
110
|
+
| `.progress-warning` | Warning (orange/yellow) progress bar |
|
|
111
|
+
| `.progress-error` | Error (red) progress bar |
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## Accessibility
|
|
116
|
+
|
|
117
|
+
- The `<progress>` element is natively accessible and announced by screen readers.
|
|
118
|
+
- Include fallback text content inside the element (e.g., `75%`) for older browsers.
|
|
119
|
+
- Wrap progress bars inside `<label>` elements to provide descriptive context.
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
→ [Voir l'exemple](../examples/progress.html)
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# µRange
|
|
2
|
+
|
|
3
|
+
**µRange** describes the native range slider styling provided by [µCSS](.) via PicoCSS. Range sliders use the standard `<input type="range">` element, which PicoCSS styles with a custom track and thumb without any additional classes.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
Wrap an `<input type="range">` inside a `<label>` for proper styling and accessibility. Use `min`, `max`, and `value` attributes to configure the range.
|
|
10
|
+
|
|
11
|
+
```html
|
|
12
|
+
<label>Volume
|
|
13
|
+
<input type="range" min="0" max="100" value="50">
|
|
14
|
+
</label>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## With live output
|
|
20
|
+
|
|
21
|
+
Pair the range input with an `<output>` element and a small `oninput` handler to display the current value in real time.
|
|
22
|
+
|
|
23
|
+
```html
|
|
24
|
+
<label>Brightness: <output id="brightness-val">75</output>%
|
|
25
|
+
<input type="range" min="0" max="100" value="75"
|
|
26
|
+
oninput="document.getElementById('brightness-val').textContent = this.value">
|
|
27
|
+
</label>
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## With steps
|
|
33
|
+
|
|
34
|
+
Use the `step` attribute to constrain the slider to discrete values.
|
|
35
|
+
|
|
36
|
+
```html
|
|
37
|
+
<label>Rating (1-5): <output id="rating-val">3</output>
|
|
38
|
+
<input type="range" min="1" max="5" step="1" value="3"
|
|
39
|
+
oninput="document.getElementById('rating-val').textContent = this.value">
|
|
40
|
+
</label>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Disabled state
|
|
46
|
+
|
|
47
|
+
Add the `disabled` attribute to prevent interaction. The slider renders in a muted style.
|
|
48
|
+
|
|
49
|
+
```html
|
|
50
|
+
<label>Locked value
|
|
51
|
+
<input type="range" min="0" max="100" value="60" disabled>
|
|
52
|
+
</label>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## In a form context
|
|
58
|
+
|
|
59
|
+
Range sliders work well inside cards (`<article>`) for settings panels.
|
|
60
|
+
|
|
61
|
+
```html
|
|
62
|
+
<article>
|
|
63
|
+
<header>Audio settings</header>
|
|
64
|
+
<label>Master volume: <output id="master-val">80</output>%
|
|
65
|
+
<input type="range" min="0" max="100" value="80"
|
|
66
|
+
oninput="document.getElementById('master-val').textContent = this.value">
|
|
67
|
+
</label>
|
|
68
|
+
<label>Bass: <output id="bass-val">50</output>%
|
|
69
|
+
<input type="range" min="0" max="100" value="50"
|
|
70
|
+
oninput="document.getElementById('bass-val').textContent = this.value">
|
|
71
|
+
</label>
|
|
72
|
+
<label>Treble: <output id="treble-val">65</output>%
|
|
73
|
+
<input type="range" min="0" max="100" value="65"
|
|
74
|
+
oninput="document.getElementById('treble-val').textContent = this.value">
|
|
75
|
+
</label>
|
|
76
|
+
</article>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## Attributes reference
|
|
82
|
+
|
|
83
|
+
| Attribute | Description | Default |
|
|
84
|
+
|------------|--------------------------------------------------|---------|
|
|
85
|
+
| `min` | Minimum value of the range | `0` |
|
|
86
|
+
| `max` | Maximum value of the range | `100` |
|
|
87
|
+
| `value` | Initial value of the slider | midpoint|
|
|
88
|
+
| `step` | Increment between allowed values | `1` |
|
|
89
|
+
| `disabled` | Prevents interaction, muted visual style | - |
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## Accessibility
|
|
94
|
+
|
|
95
|
+
- Always wrap the range input in a `<label>` to provide an accessible name.
|
|
96
|
+
- The `<output>` element is semantically linked to form controls and can be associated using the `for` attribute for screen readers.
|
|
97
|
+
- Screen readers announce the current value, minimum, and maximum of the range slider.
|
|
98
|
+
- The `disabled` attribute is natively communicated to assistive technologies.
|
|
99
|
+
- Keyboard users can adjust the slider using arrow keys.
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
→ [Voir l'exemple](../examples/range.html)
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# µSpinner
|
|
2
|
+
|
|
3
|
+
**µSpinner** is a lightweight CSS loading indicator, part of the [µCSS](.) framework. It provides an animated circular spinner available in 8 color variants and 3 sizes, with no JavaScript required.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
Add the `.spinner` class to an inline element (typically a `<span>`) to create a loading indicator.
|
|
10
|
+
|
|
11
|
+
```html
|
|
12
|
+
<span class="spinner"></span>
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
The default spinner uses the primary color and a standard size of 1.5rem.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Color variants
|
|
20
|
+
|
|
21
|
+
µSpinner supports the 8 standard µCSS color roles. Add a color modifier class alongside `.spinner`:
|
|
22
|
+
|
|
23
|
+
```html
|
|
24
|
+
<span class="spinner spinner-primary"></span>
|
|
25
|
+
<span class="spinner spinner-secondary"></span>
|
|
26
|
+
<span class="spinner spinner-tertiary"></span>
|
|
27
|
+
<span class="spinner spinner-contrast"></span>
|
|
28
|
+
<span class="spinner spinner-success"></span>
|
|
29
|
+
<span class="spinner spinner-info"></span>
|
|
30
|
+
<span class="spinner spinner-warning"></span>
|
|
31
|
+
<span class="spinner spinner-error"></span>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Color class reference
|
|
35
|
+
|
|
36
|
+
| Class | Color variable |
|
|
37
|
+
|---------------------|-------------------------|
|
|
38
|
+
| `.spinner-primary` | `--pico-primary` |
|
|
39
|
+
| `.spinner-secondary`| `--pico-secondary` |
|
|
40
|
+
| `.spinner-tertiary` | `--pico-tertiary` |
|
|
41
|
+
| `.spinner-contrast` | `--pico-contrast` |
|
|
42
|
+
| `.spinner-success` | `--pico-success` |
|
|
43
|
+
| `.spinner-info` | `--pico-info` |
|
|
44
|
+
| `.spinner-warning` | `--pico-warning` |
|
|
45
|
+
| `.spinner-error` | `--pico-error` |
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Sizes
|
|
50
|
+
|
|
51
|
+
Three sizes are available: small, default, and large.
|
|
52
|
+
|
|
53
|
+
```html
|
|
54
|
+
<!-- Small (1rem) -->
|
|
55
|
+
<span class="spinner spinner-sm spinner-primary"></span>
|
|
56
|
+
|
|
57
|
+
<!-- Default (1.5rem) -->
|
|
58
|
+
<span class="spinner spinner-primary"></span>
|
|
59
|
+
|
|
60
|
+
<!-- Large (2.5rem) -->
|
|
61
|
+
<span class="spinner spinner-lg spinner-primary"></span>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Size class reference
|
|
65
|
+
|
|
66
|
+
| Class | Width / Height | Border width |
|
|
67
|
+
|---------------|----------------|--------------|
|
|
68
|
+
| `.spinner-sm` | 1rem | 0.15em |
|
|
69
|
+
| *(default)* | 1.5rem | 0.2em |
|
|
70
|
+
| `.spinner-lg` | 2.5rem | 0.25em |
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## In-context usage
|
|
75
|
+
|
|
76
|
+
A common pattern is placing a small spinner inside a disabled button to indicate a loading state:
|
|
77
|
+
|
|
78
|
+
```html
|
|
79
|
+
<button class="btn btn-primary" disabled>
|
|
80
|
+
<span class="spinner spinner-sm"></span> Loading...
|
|
81
|
+
</button>
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## How it works
|
|
87
|
+
|
|
88
|
+
The spinner is a bordered `inline-block` element with a colored top border and a transparent-ish track (using `--pico-secondary-background`). It rotates continuously via the `mu-spin` keyframe animation (0.6s linear infinite).
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## Accessibility
|
|
93
|
+
|
|
94
|
+
The spinner is purely visual. For screen readers, pair it with appropriate text content (e.g. "Loading...") or use an `aria-label` attribute:
|
|
95
|
+
|
|
96
|
+
```html
|
|
97
|
+
<span class="spinner spinner-primary" role="status" aria-label="Loading"></span>
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
→ [Voir l'exemple](../examples/spinner.html)
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# µSwitch
|
|
2
|
+
|
|
3
|
+
**µSwitch** describes the toggle switch controls available natively in [µCSS](.) via PicoCSS. Switches are standard checkboxes enhanced with `role="switch"`, which PicoCSS styles as visual toggle switches without any additional CSS or JavaScript.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
A switch is a standard `<input type="checkbox">` with the `role="switch"` attribute, wrapped in a `<label>`.
|
|
10
|
+
|
|
11
|
+
```html
|
|
12
|
+
<label>
|
|
13
|
+
<input type="checkbox" role="switch">
|
|
14
|
+
Enable notifications
|
|
15
|
+
</label>
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Basic switch
|
|
21
|
+
|
|
22
|
+
Use `checked` to set the initial state.
|
|
23
|
+
|
|
24
|
+
```html
|
|
25
|
+
<label>
|
|
26
|
+
<input type="checkbox" role="switch">
|
|
27
|
+
Enable notifications
|
|
28
|
+
</label>
|
|
29
|
+
<label>
|
|
30
|
+
<input type="checkbox" role="switch" checked>
|
|
31
|
+
Dark mode
|
|
32
|
+
</label>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Disabled state
|
|
38
|
+
|
|
39
|
+
Add the `disabled` attribute to prevent interaction. The switch renders in a muted style.
|
|
40
|
+
|
|
41
|
+
```html
|
|
42
|
+
<label>
|
|
43
|
+
<input type="checkbox" role="switch" disabled>
|
|
44
|
+
Disabled off
|
|
45
|
+
</label>
|
|
46
|
+
<label>
|
|
47
|
+
<input type="checkbox" role="switch" disabled checked>
|
|
48
|
+
Disabled on
|
|
49
|
+
</label>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## Validation states
|
|
55
|
+
|
|
56
|
+
Use `aria-invalid` to indicate valid or invalid states visually.
|
|
57
|
+
|
|
58
|
+
```html
|
|
59
|
+
<label>
|
|
60
|
+
<input type="checkbox" role="switch" aria-invalid="false" checked>
|
|
61
|
+
Valid switch
|
|
62
|
+
</label>
|
|
63
|
+
<label>
|
|
64
|
+
<input type="checkbox" role="switch" aria-invalid="true">
|
|
65
|
+
Invalid switch
|
|
66
|
+
</label>
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
| `aria-invalid` value | Visual feedback |
|
|
70
|
+
|----------------------|--------------------------------|
|
|
71
|
+
| `"false"` | Green/success indicator |
|
|
72
|
+
| `"true"` | Red/error indicator |
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## In a form context
|
|
77
|
+
|
|
78
|
+
Switches work well inside cards (`<article>`) for settings or preference panels.
|
|
79
|
+
|
|
80
|
+
```html
|
|
81
|
+
<article>
|
|
82
|
+
<header>Preferences</header>
|
|
83
|
+
<label>
|
|
84
|
+
<input type="checkbox" role="switch" checked>
|
|
85
|
+
Receive email updates
|
|
86
|
+
</label>
|
|
87
|
+
<label>
|
|
88
|
+
<input type="checkbox" role="switch">
|
|
89
|
+
Make profile public
|
|
90
|
+
</label>
|
|
91
|
+
<label>
|
|
92
|
+
<input type="checkbox" role="switch" checked>
|
|
93
|
+
Enable two-factor authentication
|
|
94
|
+
</label>
|
|
95
|
+
</article>
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## Accessibility
|
|
101
|
+
|
|
102
|
+
- The `role="switch"` attribute tells screen readers to announce the control as a toggle switch rather than a checkbox.
|
|
103
|
+
- Always wrap the input inside a `<label>` to provide an accessible label.
|
|
104
|
+
- Screen readers will announce the state as "on" or "off" rather than "checked" or "unchecked".
|
|
105
|
+
- Use `aria-invalid` to communicate validation state to assistive technologies.
|
|
106
|
+
- The `disabled` attribute is natively understood by all screen readers.
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
→ [Voir l'exemple](../examples/switch.html)
|