mirror of
https://github.com/jdan/98.css.git
synced 2025-09-25 05:01:29 +02:00
Added mixed-value checkbox states
This commit is contained in:
@@ -229,6 +229,27 @@
|
||||
<label for="example${getCurrentId()}">I am inactive but still checked</label>
|
||||
</div>
|
||||
`) %>
|
||||
|
||||
<p>
|
||||
Checkboxes can be displayed in a mixed-value, or <code>indeterminate</code>, appearance through JavaScript. This state can also be disabled.
|
||||
</p>
|
||||
|
||||
<%- example(`
|
||||
<div class="field-row">
|
||||
<input type="checkbox" id="indeterminate-example-1">
|
||||
<label for="indeterminate-example">This is a mixed-value / indeterminate checkbox</label>
|
||||
</div>
|
||||
<div class="field-row">
|
||||
<input type="checkbox" disabled id="indeterminate-example-2">
|
||||
<label for="indeterminate-example">This is a disabled mixed-value / indeterminate checkbox</label>
|
||||
</div>
|
||||
|
||||
<!-- JavaScript -->
|
||||
<script>
|
||||
document.getElementById("indeterminate-example-1").indeterminate = true;
|
||||
document.getElementById("indeterminate-example-2").indeterminate = true;
|
||||
</script>
|
||||
`) %>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
33
icon/checkmark-mixed-value-disabled.svg
Normal file
33
icon/checkmark-mixed-value-disabled.svg
Normal file
@@ -0,0 +1,33 @@
|
||||
<svg width="7" height="7" viewBox="0 0 7 7" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M0 0h1v1h-1z" fill="#808080" />
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M2 0h1v1h-1z" fill="#808080" />
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M4 0h1v1h-1z" fill="#808080" />
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M6 0h1v1h-1z" fill="#808080" />
|
||||
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M1 1h1v1h-1z" fill="#808080" />
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M3 1h1v1h-1z" fill="#808080" />
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M5 1h1v1h-1z" fill="#808080" />
|
||||
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M0 2h1v1h-1z" fill="#808080" />
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M2 2h1v1h-1z" fill="#808080" />
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M4 2h1v1h-1z" fill="#808080" />
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M6 2h1v1h-1z" fill="#808080" />
|
||||
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M1 3h1v1h-1z" fill="#808080" />
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M3 3h1v1h-1z" fill="#808080" />
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M5 3h1v1h-1z" fill="#808080" />
|
||||
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M0 4h1v1h-1z" fill="#808080" />
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M2 4h1v1h-1z" fill="#808080" />
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M4 4h1v1h-1z" fill="#808080" />
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M6 4h1v1h-1z" fill="#808080" />
|
||||
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M1 5h1v1h-1z" fill="#808080" />
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M3 5h1v1h-1z" fill="#808080" />
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M5 5h1v1h-1z" fill="#808080" />
|
||||
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M0 6h1v1h-1z" fill="#808080" />
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M2 6h1v1h-1z" fill="#808080" />
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M4 6h1v1h-1z" fill="#808080" />
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M6 6h1v1h-1z" fill="#808080" />
|
||||
</svg>
|
After Width: | Height: | Size: 2.1 KiB |
33
icon/checkmark-mixed-value.svg
Normal file
33
icon/checkmark-mixed-value.svg
Normal file
@@ -0,0 +1,33 @@
|
||||
<svg width="7" height="7" viewBox="0 0 7 7" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M0 0h1v1h-1z" fill="black" />
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M2 0h1v1h-1z" fill="black" />
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M4 0h1v1h-1z" fill="black" />
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M6 0h1v1h-1z" fill="black" />
|
||||
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M1 1h1v1h-1z" fill="black" />
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M3 1h1v1h-1z" fill="black" />
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M5 1h1v1h-1z" fill="black" />
|
||||
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M0 2h1v1h-1z" fill="black" />
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M2 2h1v1h-1z" fill="black" />
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M4 2h1v1h-1z" fill="black" />
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M6 2h1v1h-1z" fill="black" />
|
||||
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M1 3h1v1h-1z" fill="black" />
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M3 3h1v1h-1z" fill="black" />
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M5 3h1v1h-1z" fill="black" />
|
||||
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M0 4h1v1h-1z" fill="black" />
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M2 4h1v1h-1z" fill="black" />
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M4 4h1v1h-1z" fill="black" />
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M6 4h1v1h-1z" fill="black" />
|
||||
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M1 5h1v1h-1z" fill="black" />
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M3 5h1v1h-1z" fill="black" />
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M5 5h1v1h-1z" fill="black" />
|
||||
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M0 6h1v1h-1z" fill="black" />
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M2 6h1v1h-1z" fill="black" />
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M4 6h1v1h-1z" fill="black" />
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M6 6h1v1h-1z" fill="black" />
|
||||
</svg>
|
After Width: | Height: | Size: 2.1 KiB |
11
style.css
11
style.css
@@ -451,7 +451,8 @@ input[type="checkbox"]:active + label::before {
|
||||
background: var(--surface);
|
||||
}
|
||||
|
||||
input[type="checkbox"]:checked + label::after {
|
||||
input[type="checkbox"]:checked + label::after,
|
||||
input[type="checkbox"]:indeterminate + label::after {
|
||||
content: "";
|
||||
display: block;
|
||||
width: var(--checkmark-width);
|
||||
@@ -463,6 +464,10 @@ input[type="checkbox"]:checked + label::after {
|
||||
background: svg-load("./icon/checkmark.svg");
|
||||
}
|
||||
|
||||
input[type="checkbox"]:indeterminate + label::after {
|
||||
background: svg-load("./icon/checkmark-mixed-value.svg");
|
||||
}
|
||||
|
||||
input[type="checkbox"][disabled] + label::before {
|
||||
background: var(--surface);
|
||||
}
|
||||
@@ -471,6 +476,10 @@ input[type="checkbox"][disabled]:checked + label::after {
|
||||
background: svg-load("./icon/checkmark-disabled.svg");
|
||||
}
|
||||
|
||||
input[type="checkbox"][disabled]:indeterminate + label::after {
|
||||
background: svg-load("./icon/checkmark-mixed-value-disabled.svg");
|
||||
}
|
||||
|
||||
input[type="text"],
|
||||
input[type="password"],
|
||||
input[type="email"],
|
||||
|
Reference in New Issue
Block a user