Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions docs/index.html.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -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>, state 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>

Expand Down
33 changes: 33 additions & 0 deletions icon/checkmark-mixed-value-disabled.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions icon/checkmark-mixed-value.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 10 additions & 1 deletion style.css
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
}
Expand All @@ -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"],
Expand Down