Tailwind classes have no effect on a checkbox
Tailwind CSS checkbox styles are not workingShort answer
A native checkbox keeps the browser's own styling, so ordinary colour and border utilities do not behave as they do on a div. Pick the fix by how much control you need: accent-* changes the tick colour, appearance-none lets you style the box from scratch, and the @tailwindcss/forms plugin gives a resettable base.
Fix it fast
1Find out which cause you have
Check that other utilities work on the page first, so you know the problem is the checkbox and not the Tailwind setup.
grep -rn "type=\"checkbox\"" app components | head2Match what you see, then jump to its fix
- 1
Background utilities such as bg-blue-500 do not give the checked colour you expect.You only want a different colour: the native control needs accent-colorFix - 2
Border, size and rounded utilities are ignored or look odd.You want full control of the box: the browser styling is still onFix - 3
Many inputs across a project, each needing the same reset.You want sensible defaults for every form fieldFix
- 1
What does the error look like?
Tailwind CSS checkbox styles are not working
Cause 1 of 3
You only want a different colour: the native control needs accent-color
1Check
The accent utilities control the accented colour of a form control.
grep -rn "accent-" app components2Fix
Add an accent utility to the input.
<input type="checkbox" class="accent-pink-500" checked />3Verify
The checked box is pink.
npm run devConfirmed by tailwindcss.com
Cause 2 of 3
You want full control of the box: the browser styling is still on
1Check
appearance-none suppresses native form control styling. After that, the box is a plain element you style yourself.
grep -rn "appearance-" app components2Fix
Reset the appearance, then style the checked state. Restore the default under forced colours for accessibility.
<input
type="checkbox"
class="size-5 appearance-none rounded border border-gray-400 checked:bg-indigo-600 checked:border-indigo-600 forced-colors:appearance-auto"
/>3Verify
The box is a custom square and turns indigo when checked.
npm run devConfirmed by tailwindcss.com
Cause 3 of 3
You want sensible defaults for every form field
1Check
The @tailwindcss/forms plugin generates global form styles. With it, a checkbox is coloured by text colour utilities and rounded by rounded.
npm ls @tailwindcss/forms2Fix
Install the plugin and register it. On Tailwind v4 add it to the main stylesheet; on v3 add it to the plugins array.
npm install -D @tailwindcss/forms
/* v4: main stylesheet */
@plugin "@tailwindcss/forms";
// v3: tailwind.config.js
plugins: [require('@tailwindcss/forms')],
<input type="checkbox" class="rounded text-pink-500" />3Verify
The checkbox is rounded and uses the text colour when checked.
npm run devConfirmed by github.com
How do I stop it coming back?
- Choose one approach per project: accent-* only, appearance-none, or the forms plugin.
- Keep forced-colors:appearance-auto on custom checkboxes so high contrast mode still works.
- Set the plugin strategy to class if you do not want every form field restyled.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
Related fixes
Web apps
Tailwind classes have no effect in a Next.js app
Styles from Tailwind never reach the page after install
The page loads but Tailwind classes do nothing when the generated CSS never reaches the page.
5 causes, each with a fixWeb apps
There is no tailwind.config.js after installing Tailwind 4 and HeroUI in Next.js
HeroUI components render unstyled
Nothing is broken: Tailwind CSS 4 is configured in CSS and no longer creates tailwind.config.js.
3 causes, each with a fixWeb apps
Hydration failed after adding next-themes dark mode
Console reports a server and client mismatch on the html element
next-themes changes the html element and knows the theme only in the browser, so server HTML and client HTML differ.
3 causes, each with a fixWeb apps
Next.js fails with Cannot find module 'tailwindcss'
Error: Cannot find module 'tailwindcss'
Next.js loads Tailwind through PostCSS, so the error means the package named in postcss.config is not installed where the build runs.
3 causes, each with a fixWeb apps
A shadcn/ui Dialog stays open after the form is submitted
Form submits and the data saves, but the modal remains on screen
A shadcn Dialog is a Radix dialog.
3 causes, each with a fixWeb apps
Tailwind CSS 4 build fails on @apply in a Next.js project
Cannot apply unknown utility class
Tailwind 4 only knows its utilities in a stylesheet that imports Tailwind.
2 causes, each with a fix