[Question] How to trigger Checkbox component error state #5561
-
From the Checkbox spec, I see that Checkbox has error state. Please help to shed some light on this. Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
We removed the error state from checkbox in 1.0.0-pre.15 since design was still exploring an error checkbox state and did not finalize guidelines of when or how to use it. Since we didn't have a clear signal (and because similar components like switch/radio don't have error states), we removed it to reduce our API support. You can theme a checkbox with the error system color and add <style>
:root {
--md-sys-color-error: red;
}
md-checkbox.error {
--md-sys-color-primary: var(--md-sys-color-error);
--md-checkbox-outline-color: var(--md-sys-color-error);
--md-checkbox-hover-outline-color: var(--md-sys-color-error);
--md-checkbox-focus-outline-color: var(--md-sys-color-error);
--md-checkbox-pressed-outline-color: var(--md-sys-color-error);
}
</style>
<md-checkbox class="error" aria-invalid="true"></md-checkbox> |
Beta Was this translation helpful? Give feedback.
We removed the error state from checkbox in 1.0.0-pre.15 since design was still exploring an error checkbox state and did not finalize guidelines of when or how to use it.
Since we didn't have a clear signal (and because similar components like switch/radio don't have error states), we removed it to reduce our API support.
You can theme a checkbox with the error system color and add
aria-invalid
to make an error checkbox.