Performance: Disabled state styling
This affects the rendering speed and visual stability when styling disabled UI elements.
<button class="disabled:opacity-50 disabled:cursor-not-allowed">Click me</button><button class="disabled:opacity-50 disabled:cursor-not-allowed disabled:border-2 disabled:border-gray-400">Click me</button>| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Disabled border change | Minimal | 1 reflow per toggle | Medium paint cost | [X] Bad |
| Disabled opacity and cursor only | Minimal | 0 reflows | Low paint cost | [OK] Good |
disabled: prefix in Tailwind CSS do?disabled attributedisabled attribute marks an element as inactive or unusable.disabled: prefixdisabled: prefix applies CSS styles only when the element is disabled, allowing visual changes without affecting functionality.disabled attribute -> Option Cnot-allowed, which shows a 'no' symbol.disabled:cursor-not-allowed. Plain cursor-not-allowed applies always.<button disabled class="bg-blue-500 disabled:bg-gray-400">Click me</button>
disabled attribute, so disabled styles apply.bg-blue-500. When disabled, disabled:bg-gray-400 overrides it to gray.<input disabled class="disabled:bg-gray-300 cursor-not-allowed" />
disabled attribute, so disabled styles can apply.cursor-not-allowed applies always. To apply only when disabled, it should be disabled:cursor-not-allowed.bg-blue-600 for blue background and text-white for white text normally.disabled:bg-gray-400 for gray background and disabled:text-gray-300 for lighter gray text when disabled.Pass the test and this pattern moves unknown