Performance: Button component patterns
MEDIUM IMPACT
This affects page load speed and interaction responsiveness by how button styles and behaviors are implemented.
<button class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded shadow-md transition-colors duration-150">Click me</button><button class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded inline-block" style="box-shadow: 0 0 10px rgba(0,0,0,0.5); transition: all 0.5s ease;">Click me</button>
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Inline styles with complex shadows and transitions | Low | 0-1 per hover | High (multiple paints) | [X] Bad |
| Tailwind utility classes for shadows and transitions | Low | 0-1 per hover | Low (single paint) | [OK] Good |
| Inline styles for disabled state | Low | 2 per state change | Medium | [X] Bad |
| Tailwind classes for disabled state | Low | 1 per state change | Low | [OK] Good |
| Inline SVG styles inside button | Medium (extra nodes) | 0 | Medium | [X] Bad |
| Tailwind classes for SVG sizing and spacing | Medium (extra nodes) | 0 | Low | [OK] Good |