Skip to content

Input type checkbox with class btn has only primary color when checked #3090

Closed Answered by saadeghi
samtvn asked this question in Q&A
Discussion options

You must be logged in to vote

This is not supported yet, because btn-outline apply styles based on btn-secondary colors (because the border and text color should adapt the secondary color if it is a secondary button) and that will override your checked:bg-secondary class.

Until we add the styles to make these class names compatible with checked state, you can add this custom CSS to make it work:
https://play.tailwindcss.com/OK0WdnfJyf?file=css

.btn.btn-secondary:is(input[type="checkbox"]:checked) {
  border-color: oklch(var(--btn-color));
  background-color: oklch(var(--btn-color));
  color: oklch(var(--sc));
}

Let me know if you have a question.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by saadeghi
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