@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,135 @@
|
|
|
1
|
+
# µCard
|
|
2
|
+
|
|
3
|
+
**µCard** provides colored card variants for the `<article>` element, part of the [µCSS](.) framework. It extends PicoCSS's default card styling with 8 color accents, automatic header/footer shading, and a left border indicator.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
Cards use the standard HTML `<article>` element. Add a color class to apply a colored variant with a left border accent and tinted background.
|
|
10
|
+
|
|
11
|
+
```html
|
|
12
|
+
<article class="card-primary">
|
|
13
|
+
<header>Card title</header>
|
|
14
|
+
Card body content.
|
|
15
|
+
<footer>Card footer</footer>
|
|
16
|
+
</article>
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
A card can contain any combination of `<header>`, body content, and `<footer>`. All three sections are optional.
|
|
20
|
+
|
|
21
|
+
### Body only
|
|
22
|
+
|
|
23
|
+
```html
|
|
24
|
+
<article class="card-info">
|
|
25
|
+
<p>A simple card with content only, no header or footer.</p>
|
|
26
|
+
</article>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Default card (no color)
|
|
30
|
+
|
|
31
|
+
Without a color class, `<article>` renders with the standard PicoCSS card styling:
|
|
32
|
+
|
|
33
|
+
```html
|
|
34
|
+
<article>
|
|
35
|
+
<header>Standard card</header>
|
|
36
|
+
This card uses the default styling without any color class.
|
|
37
|
+
<footer>Footer</footer>
|
|
38
|
+
</article>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Color variants
|
|
44
|
+
|
|
45
|
+
8 color classes are available, matching the µCSS color roles:
|
|
46
|
+
|
|
47
|
+
| Class | Color role | Left border | Background |
|
|
48
|
+
|-------------------|------------|----------------------|----------------------------|
|
|
49
|
+
| `.card-primary` | Primary | `--pico-primary` | `--pico-primary-background` |
|
|
50
|
+
| `.card-secondary` | Secondary | `--pico-secondary` | `--pico-secondary-background` |
|
|
51
|
+
| `.card-tertiary` | Tertiary | `--pico-tertiary` | `--pico-tertiary-background` |
|
|
52
|
+
| `.card-contrast` | Contrast | `--pico-contrast` | `--pico-contrast-background` |
|
|
53
|
+
| `.card-success` | Success | `--pico-success` | `--pico-success-background` |
|
|
54
|
+
| `.card-info` | Info | `--pico-info` | `--pico-info-background` |
|
|
55
|
+
| `.card-warning` | Warning | `--pico-warning` | `--pico-warning-background` |
|
|
56
|
+
| `.card-error` | Error | `--pico-error` | `--pico-error-background` |
|
|
57
|
+
|
|
58
|
+
### All 8 variants example
|
|
59
|
+
|
|
60
|
+
```html
|
|
61
|
+
<div class="row">
|
|
62
|
+
<div class="col-12 col-md-6">
|
|
63
|
+
<article class="card-primary">
|
|
64
|
+
<header>Primary</header>
|
|
65
|
+
Card body with primary accent.
|
|
66
|
+
<footer>Card footer</footer>
|
|
67
|
+
</article>
|
|
68
|
+
</div>
|
|
69
|
+
<div class="col-12 col-md-6">
|
|
70
|
+
<article class="card-secondary">
|
|
71
|
+
<header>Secondary</header>
|
|
72
|
+
Card body with secondary accent.
|
|
73
|
+
<footer>Card footer</footer>
|
|
74
|
+
</article>
|
|
75
|
+
</div>
|
|
76
|
+
<div class="col-12 col-md-6">
|
|
77
|
+
<article class="card-success">
|
|
78
|
+
<header>Success</header>
|
|
79
|
+
Card body with success accent.
|
|
80
|
+
<footer>Card footer</footer>
|
|
81
|
+
</article>
|
|
82
|
+
</div>
|
|
83
|
+
<div class="col-12 col-md-6">
|
|
84
|
+
<article class="card-error">
|
|
85
|
+
<header>Error</header>
|
|
86
|
+
Card body with error accent.
|
|
87
|
+
<footer>Card footer</footer>
|
|
88
|
+
</article>
|
|
89
|
+
</div>
|
|
90
|
+
</div>
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Visual structure
|
|
96
|
+
|
|
97
|
+
Colored cards (`article[class*="card-"]`) apply the following styles:
|
|
98
|
+
|
|
99
|
+
- **Left border**: 4px solid in the card's color role.
|
|
100
|
+
- **Background**: the card's light background tint.
|
|
101
|
+
- **Header/footer background**: a `color-mix()` blend of 12% card color into the card background, creating a subtle shading difference.
|
|
102
|
+
- **Header border-bottom / footer border-top**: `color-mix()` blend of 20% card color, providing a gentle separator.
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## PicoCSS override
|
|
107
|
+
|
|
108
|
+
µCard includes one global fix:
|
|
109
|
+
|
|
110
|
+
```css
|
|
111
|
+
article > *:last-child:not(header):not(footer) {
|
|
112
|
+
margin-bottom: 0;
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
This removes the bottom margin on the last content element inside a card (e.g., a `<p>` tag), preventing unwanted spacing before the card's bottom edge or footer. This is necessary because PicoCSS applies default margins to `<p>` elements.
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## CSS classes reference
|
|
121
|
+
|
|
122
|
+
| Class | Description |
|
|
123
|
+
|-------------------|--------------------------------------------------|
|
|
124
|
+
| `.card-primary` | Primary color variant |
|
|
125
|
+
| `.card-secondary` | Secondary color variant |
|
|
126
|
+
| `.card-tertiary` | Tertiary color variant |
|
|
127
|
+
| `.card-contrast` | Contrast color variant |
|
|
128
|
+
| `.card-success` | Success color variant |
|
|
129
|
+
| `.card-info` | Info color variant |
|
|
130
|
+
| `.card-warning` | Warning color variant |
|
|
131
|
+
| `.card-error` | Error color variant |
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
→ [Voir l'exemple](../examples/card.html)
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# µCheckbox & Radio
|
|
2
|
+
|
|
3
|
+
**µCheckbox & Radio** describes the native checkbox and radio button styling provided by [µCSS](.) via PicoCSS. These are standard HTML form controls (`<input type="checkbox">` and `<input type="radio">`) that PicoCSS styles automatically without any additional classes.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Checkboxes
|
|
8
|
+
|
|
9
|
+
### Basic usage
|
|
10
|
+
|
|
11
|
+
Wrap each `<input type="checkbox">` inside a `<label>` for proper styling and accessibility. Use a `<fieldset>` with `<legend>` to group related checkboxes.
|
|
12
|
+
|
|
13
|
+
```html
|
|
14
|
+
<fieldset>
|
|
15
|
+
<legend>Select your interests</legend>
|
|
16
|
+
<label><input type="checkbox" checked> Design</label>
|
|
17
|
+
<label><input type="checkbox"> Development</label>
|
|
18
|
+
<label><input type="checkbox"> Marketing</label>
|
|
19
|
+
<label><input type="checkbox" disabled> Disabled option</label>
|
|
20
|
+
</fieldset>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Indeterminate state
|
|
24
|
+
|
|
25
|
+
The indeterminate state is set via JavaScript and represents a "partially checked" visual state.
|
|
26
|
+
|
|
27
|
+
```html
|
|
28
|
+
<label>
|
|
29
|
+
<input type="checkbox" id="indeterminate-check"> Indeterminate state
|
|
30
|
+
</label>
|
|
31
|
+
<script>document.getElementById('indeterminate-check').indeterminate = true;</script>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Checkbox validation
|
|
35
|
+
|
|
36
|
+
Use `aria-invalid` to visually indicate valid or invalid checkboxes.
|
|
37
|
+
|
|
38
|
+
```html
|
|
39
|
+
<label><input type="checkbox" aria-invalid="false" checked> Valid checkbox</label>
|
|
40
|
+
<label><input type="checkbox" aria-invalid="true"> Invalid checkbox</label>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Radio buttons
|
|
46
|
+
|
|
47
|
+
### Basic usage
|
|
48
|
+
|
|
49
|
+
Radio buttons use `<input type="radio">` with a shared `name` attribute to form a mutually exclusive group. Wrap them in a `<fieldset>` with `<legend>`.
|
|
50
|
+
|
|
51
|
+
```html
|
|
52
|
+
<fieldset>
|
|
53
|
+
<legend>Choose a plan</legend>
|
|
54
|
+
<label><input type="radio" name="plan" checked> Free</label>
|
|
55
|
+
<label><input type="radio" name="plan"> Pro</label>
|
|
56
|
+
<label><input type="radio" name="plan"> Enterprise</label>
|
|
57
|
+
<label><input type="radio" name="plan" disabled> Deprecated plan</label>
|
|
58
|
+
</fieldset>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Radio validation
|
|
62
|
+
|
|
63
|
+
Use `aria-invalid` on individual radio inputs to indicate validation state.
|
|
64
|
+
|
|
65
|
+
```html
|
|
66
|
+
<fieldset>
|
|
67
|
+
<legend>Select a valid option</legend>
|
|
68
|
+
<label><input type="radio" name="valid-radio" aria-invalid="false" checked> Valid choice</label>
|
|
69
|
+
<label><input type="radio" name="invalid-radio" aria-invalid="true"> Invalid choice</label>
|
|
70
|
+
</fieldset>
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## In a form
|
|
76
|
+
|
|
77
|
+
Checkboxes and radio buttons can be combined inside a card (`<article>`) for structured forms.
|
|
78
|
+
|
|
79
|
+
```html
|
|
80
|
+
<article>
|
|
81
|
+
<header>Registration</header>
|
|
82
|
+
<fieldset>
|
|
83
|
+
<legend>Account type</legend>
|
|
84
|
+
<label><input type="radio" name="type" checked> Personal</label>
|
|
85
|
+
<label><input type="radio" name="type"> Business</label>
|
|
86
|
+
</fieldset>
|
|
87
|
+
<fieldset>
|
|
88
|
+
<legend>Agreements</legend>
|
|
89
|
+
<label><input type="checkbox" required> I accept the terms and conditions</label>
|
|
90
|
+
<label><input type="checkbox"> Subscribe to newsletter</label>
|
|
91
|
+
</fieldset>
|
|
92
|
+
</article>
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## States reference
|
|
98
|
+
|
|
99
|
+
| Attribute | Effect |
|
|
100
|
+
|--------------------|--------------------------------------------------|
|
|
101
|
+
| `checked` | Sets the default checked state |
|
|
102
|
+
| `disabled` | Prevents interaction, muted visual style |
|
|
103
|
+
| `required` | Marks the field as mandatory for form submission |
|
|
104
|
+
| `aria-invalid="false"` | Green/success visual indicator |
|
|
105
|
+
| `aria-invalid="true"` | Red/error visual indicator |
|
|
106
|
+
| `indeterminate` (JS) | Partially checked visual state (checkbox only) |
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## Accessibility
|
|
111
|
+
|
|
112
|
+
- Always wrap inputs in a `<label>` to associate the label text with the control.
|
|
113
|
+
- Use `<fieldset>` and `<legend>` to group related checkboxes or radio buttons. Screen readers announce the group label when entering the fieldset.
|
|
114
|
+
- Radio buttons sharing the same `name` attribute are announced as a group by screen readers.
|
|
115
|
+
- The `disabled` attribute natively prevents focus and interaction and is communicated to assistive technologies.
|
|
116
|
+
- Use `aria-invalid` to communicate validation state to screen readers.
|
|
117
|
+
- The `required` attribute is announced by screen readers and triggers native browser validation.
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
→ [Voir l'exemple](../examples/checkbox-radio.html)
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
# µDropdown
|
|
2
|
+
|
|
3
|
+
**µDropdown** fournit des menus deroulants CSS purs via l'element `<details class="dropdown">`, styles par [PicoCSS](https://picocss.com) au sein du framework [µCSS](.). Aucun JavaScript n'est necessaire : l'ouverture et la fermeture sont gerees nativement par le navigateur.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Utilisation de base
|
|
8
|
+
|
|
9
|
+
Un dropdown est construit avec `<details class="dropdown">`. Le `<summary>` sert de declencheur et la liste `<ul>` contient les options.
|
|
10
|
+
|
|
11
|
+
```html
|
|
12
|
+
<details class="dropdown">
|
|
13
|
+
<summary>Select an option</summary>
|
|
14
|
+
<ul>
|
|
15
|
+
<li><a href="#">Option 1</a></li>
|
|
16
|
+
<li><a href="#">Option 2</a></li>
|
|
17
|
+
<li><a href="#">Option 3</a></li>
|
|
18
|
+
</ul>
|
|
19
|
+
</details>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Style bouton
|
|
25
|
+
|
|
26
|
+
Ajoutez `role="button"` sur le `<summary>` pour lui donner l'apparence d'un bouton.
|
|
27
|
+
|
|
28
|
+
```html
|
|
29
|
+
<details class="dropdown">
|
|
30
|
+
<summary role="button">Actions</summary>
|
|
31
|
+
<ul>
|
|
32
|
+
<li><a href="#">Edit</a></li>
|
|
33
|
+
<li><a href="#">Duplicate</a></li>
|
|
34
|
+
<li><a href="#">Archive</a></li>
|
|
35
|
+
<li><a href="#">Delete</a></li>
|
|
36
|
+
</ul>
|
|
37
|
+
</details>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Variantes natives PicoCSS
|
|
43
|
+
|
|
44
|
+
PicoCSS fournit des variantes de style via des classes sur le `<summary role="button">` :
|
|
45
|
+
|
|
46
|
+
| Classe | Apparence |
|
|
47
|
+
|--------|-----------|
|
|
48
|
+
| *(aucune)* | Primary (defaut) |
|
|
49
|
+
| `.secondary` | Secondary |
|
|
50
|
+
| `.contrast` | Contrast |
|
|
51
|
+
| `.outline` | Outline |
|
|
52
|
+
|
|
53
|
+
```html
|
|
54
|
+
<details class="dropdown">
|
|
55
|
+
<summary role="button">Primary</summary>
|
|
56
|
+
<ul>
|
|
57
|
+
<li><a href="#">Item A</a></li>
|
|
58
|
+
<li><a href="#">Item B</a></li>
|
|
59
|
+
</ul>
|
|
60
|
+
</details>
|
|
61
|
+
|
|
62
|
+
<details class="dropdown">
|
|
63
|
+
<summary role="button" class="secondary">Secondary</summary>
|
|
64
|
+
<ul>
|
|
65
|
+
<li><a href="#">Item A</a></li>
|
|
66
|
+
<li><a href="#">Item B</a></li>
|
|
67
|
+
</ul>
|
|
68
|
+
</details>
|
|
69
|
+
|
|
70
|
+
<details class="dropdown">
|
|
71
|
+
<summary role="button" class="contrast">Contrast</summary>
|
|
72
|
+
<ul>
|
|
73
|
+
<li><a href="#">Item A</a></li>
|
|
74
|
+
<li><a href="#">Item B</a></li>
|
|
75
|
+
</ul>
|
|
76
|
+
</details>
|
|
77
|
+
|
|
78
|
+
<details class="dropdown">
|
|
79
|
+
<summary role="button" class="outline">Outline</summary>
|
|
80
|
+
<ul>
|
|
81
|
+
<li><a href="#">Item A</a></li>
|
|
82
|
+
<li><a href="#">Item B</a></li>
|
|
83
|
+
</ul>
|
|
84
|
+
</details>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## Variantes de couleur µCSS
|
|
90
|
+
|
|
91
|
+
µCSS etend les dropdowns avec les classes `.btn-*` sur le `<summary>` pour les 8 roles de couleur :
|
|
92
|
+
|
|
93
|
+
| Classe | Couleur |
|
|
94
|
+
|--------|---------|
|
|
95
|
+
| `.btn-primary` | Primary |
|
|
96
|
+
| `.btn-secondary` | Secondary |
|
|
97
|
+
| `.btn-tertiary` | Tertiary |
|
|
98
|
+
| `.btn-contrast` | Contrast |
|
|
99
|
+
| `.btn-success` | Success |
|
|
100
|
+
| `.btn-info` | Info |
|
|
101
|
+
| `.btn-warning` | Warning |
|
|
102
|
+
| `.btn-error` | Error |
|
|
103
|
+
|
|
104
|
+
```html
|
|
105
|
+
<details class="dropdown">
|
|
106
|
+
<summary role="button" class="btn-primary">Primary</summary>
|
|
107
|
+
<ul>
|
|
108
|
+
<li><a href="#">Item A</a></li>
|
|
109
|
+
<li><a href="#">Item B</a></li>
|
|
110
|
+
</ul>
|
|
111
|
+
</details>
|
|
112
|
+
|
|
113
|
+
<details class="dropdown">
|
|
114
|
+
<summary role="button" class="btn-success">Success</summary>
|
|
115
|
+
<ul>
|
|
116
|
+
<li><a href="#">Item A</a></li>
|
|
117
|
+
<li><a href="#">Item B</a></li>
|
|
118
|
+
</ul>
|
|
119
|
+
</details>
|
|
120
|
+
|
|
121
|
+
<details class="dropdown">
|
|
122
|
+
<summary role="button" class="btn-error">Error</summary>
|
|
123
|
+
<ul>
|
|
124
|
+
<li><a href="#">Item A</a></li>
|
|
125
|
+
<li><a href="#">Item B</a></li>
|
|
126
|
+
</ul>
|
|
127
|
+
</details>
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## Remplacement de select
|
|
133
|
+
|
|
134
|
+
Un dropdown peut servir d'alternative stylee a un `<select>` natif en le placant dans un `<label>`.
|
|
135
|
+
|
|
136
|
+
```html
|
|
137
|
+
<label>Choose a fruit
|
|
138
|
+
<details class="dropdown">
|
|
139
|
+
<summary>Pick one...</summary>
|
|
140
|
+
<ul>
|
|
141
|
+
<li><a href="#">Apple</a></li>
|
|
142
|
+
<li><a href="#">Banana</a></li>
|
|
143
|
+
<li><a href="#">Cherry</a></li>
|
|
144
|
+
<li><a href="#">Mango</a></li>
|
|
145
|
+
<li><a href="#">Orange</a></li>
|
|
146
|
+
</ul>
|
|
147
|
+
</details>
|
|
148
|
+
</label>
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
**Note :** contrairement a un `<select>` natif, la valeur selectionnee n'est pas geree automatiquement. Un minimum de JavaScript applicatif est necessaire pour mettre a jour le texte du `<summary>` apres selection.
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## Structure
|
|
156
|
+
|
|
157
|
+
```
|
|
158
|
+
<details class="dropdown">
|
|
159
|
+
<summary [role="button"] [class="btn-*"]>Trigger text</summary>
|
|
160
|
+
<ul>
|
|
161
|
+
<li><a href="#">Menu item</a></li>
|
|
162
|
+
...
|
|
163
|
+
</ul>
|
|
164
|
+
</details>
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
| Element | Role |
|
|
168
|
+
|---------|------|
|
|
169
|
+
| `<details class="dropdown">` | Conteneur du dropdown |
|
|
170
|
+
| `<summary>` | Declencheur (texte ou bouton) |
|
|
171
|
+
| `<summary role="button">` | Declencheur avec apparence bouton |
|
|
172
|
+
| `<ul>` | Liste des options |
|
|
173
|
+
| `<li><a>` | Element de menu cliquable |
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## Accessibilite
|
|
178
|
+
|
|
179
|
+
- Le composant repose sur l'element natif `<details>`/`<summary>`, accessible par defaut au clavier (ouverture via `Enter` ou `Space`).
|
|
180
|
+
- L'attribut `role="button"` sur `<summary>` informe les technologies d'assistance que l'element agit comme un bouton.
|
|
181
|
+
- Le menu se ferme automatiquement lorsque l'utilisateur clique en dehors (comportement natif de `<details>`).
|
|
182
|
+
|
|
183
|
+
→ [Voir l'exemple](../examples/dropdown.html)
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
# µForms (advanced)
|
|
2
|
+
|
|
3
|
+
**µForms (advanced)** describes the specialized native input types styled by [µCSS](.) via PicoCSS. These include color pickers, date/time inputs, file uploads, search fields, and other input types, all styled automatically without additional classes.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Color picker
|
|
8
|
+
|
|
9
|
+
The `<input type="color">` renders a native color picker widget.
|
|
10
|
+
|
|
11
|
+
```html
|
|
12
|
+
<label>Pick a color
|
|
13
|
+
<input type="color" value="#0172ad">
|
|
14
|
+
</label>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Date & time inputs
|
|
20
|
+
|
|
21
|
+
PicoCSS styles all native date and time input types consistently.
|
|
22
|
+
|
|
23
|
+
```html
|
|
24
|
+
<label>Date
|
|
25
|
+
<input type="date">
|
|
26
|
+
</label>
|
|
27
|
+
<label>Time
|
|
28
|
+
<input type="time">
|
|
29
|
+
</label>
|
|
30
|
+
<label>Date and time
|
|
31
|
+
<input type="datetime-local">
|
|
32
|
+
</label>
|
|
33
|
+
<label>Month
|
|
34
|
+
<input type="month">
|
|
35
|
+
</label>
|
|
36
|
+
<label>Week
|
|
37
|
+
<input type="week">
|
|
38
|
+
</label>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
| Input type | Description |
|
|
42
|
+
|--------------------|--------------------------------------|
|
|
43
|
+
| `date` | Date picker (year-month-day) |
|
|
44
|
+
| `time` | Time picker (hours-minutes) |
|
|
45
|
+
| `datetime-local` | Combined date and time picker |
|
|
46
|
+
| `month` | Month and year picker |
|
|
47
|
+
| `week` | Week and year picker |
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## File upload
|
|
52
|
+
|
|
53
|
+
The `<input type="file">` renders a styled file selection button. Add `multiple` to allow selecting more than one file.
|
|
54
|
+
|
|
55
|
+
```html
|
|
56
|
+
<label>Choose a file
|
|
57
|
+
<input type="file">
|
|
58
|
+
</label>
|
|
59
|
+
<label>Multiple files
|
|
60
|
+
<input type="file" multiple>
|
|
61
|
+
</label>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Search
|
|
67
|
+
|
|
68
|
+
The `<input type="search">` renders a text field with a search-specific style (including a clear button in some browsers).
|
|
69
|
+
|
|
70
|
+
```html
|
|
71
|
+
<label>Search
|
|
72
|
+
<input type="search" placeholder="Search...">
|
|
73
|
+
</label>
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Search with group
|
|
77
|
+
|
|
78
|
+
Wrap a search input and button inside a `<div role="search">` for a grouped search bar layout.
|
|
79
|
+
|
|
80
|
+
```html
|
|
81
|
+
<div role="search">
|
|
82
|
+
<input type="search" placeholder="Search...">
|
|
83
|
+
<button>Go</button>
|
|
84
|
+
</div>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## Other input types
|
|
90
|
+
|
|
91
|
+
PicoCSS styles several additional input types natively.
|
|
92
|
+
|
|
93
|
+
```html
|
|
94
|
+
<label>Number
|
|
95
|
+
<input type="number" value="42" min="0" max="100">
|
|
96
|
+
</label>
|
|
97
|
+
<label>URL
|
|
98
|
+
<input type="url" placeholder="https://example.com">
|
|
99
|
+
</label>
|
|
100
|
+
<label>Telephone
|
|
101
|
+
<input type="tel" placeholder="+1 (555) 123-4567">
|
|
102
|
+
</label>
|
|
103
|
+
<label>Password
|
|
104
|
+
<input type="password" value="secret123">
|
|
105
|
+
</label>
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## Disabled & readonly
|
|
111
|
+
|
|
112
|
+
Use `disabled` to prevent all interaction, or `readonly` to allow selection and copying but prevent editing.
|
|
113
|
+
|
|
114
|
+
```html
|
|
115
|
+
<label>Disabled input
|
|
116
|
+
<input type="text" value="Cannot edit" disabled>
|
|
117
|
+
</label>
|
|
118
|
+
<label>Readonly input
|
|
119
|
+
<input type="text" value="Read only" readonly>
|
|
120
|
+
</label>
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
| Attribute | User can select text | User can edit | Submitted with form |
|
|
124
|
+
|-------------|---------------------|---------------|---------------------|
|
|
125
|
+
| `disabled` | No | No | No |
|
|
126
|
+
| `readonly` | Yes | No | Yes |
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## Validation states & helper text
|
|
131
|
+
|
|
132
|
+
Use `aria-invalid` to indicate validation state visually. Add a `<small>` element after the input inside the `<label>` for helper or error messages.
|
|
133
|
+
|
|
134
|
+
```html
|
|
135
|
+
<label>Email
|
|
136
|
+
<input type="email" placeholder="user@example.com" aria-invalid="true">
|
|
137
|
+
<small>Please enter a valid email address.</small>
|
|
138
|
+
</label>
|
|
139
|
+
<label>Username
|
|
140
|
+
<input type="text" value="johndoe" aria-invalid="false">
|
|
141
|
+
<small>Username is available.</small>
|
|
142
|
+
</label>
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
| `aria-invalid` value | Visual feedback |
|
|
146
|
+
|----------------------|------------------------------------------|
|
|
147
|
+
| `"true"` | Red/error border and helper text color |
|
|
148
|
+
| `"false"` | Green/success border and helper text color |
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## Accessibility
|
|
153
|
+
|
|
154
|
+
- Always wrap inputs in a `<label>` to provide an accessible name.
|
|
155
|
+
- Use `aria-invalid` to communicate validation state to screen readers.
|
|
156
|
+
- The `<small>` helper text following an input is visually associated; for explicit screen reader association, use `aria-describedby`.
|
|
157
|
+
- `disabled` and `readonly` states are natively communicated to assistive technologies.
|
|
158
|
+
- The `role="search"` landmark on the search group container helps screen readers identify the search region.
|
|
159
|
+
- File inputs announce the selected file name(s) to screen readers.
|
|
160
|
+
- Date and time pickers use native browser widgets that provide built-in keyboard and screen reader support.
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
→ [Voir l'exemple](../examples/forms-advanced.html)
|