Skip to content

[Question] How to trigger Checkbox component error state #5561

Answered by asyncLiz
VietNguyenQuoc asked this question in Q&A
Discussion options

You must be logged in to vote

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.

<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-checkb…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@VietNguyenQuoc
Comment options

Answer selected by VietNguyenQuoc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants