Buttons
A practical breakdown of button variants developers actually ship in dashboards, landing pages, and auth flows.
In this article
The most common mistake in product UI is treating each button as a one-off design decision. Instead, define a four-variant family early: primary (solid fill), secondary (subtle background), outline (border only), and ghost (transparent). These four cover 90% of real product states — CTAs, secondary actions, tertiary controls, and icon buttons. Once the family is stable, adding loading, icon-left, icon-right, split, and gradient variants becomes systematic rather than random. Every new variant inherits the same size scale (sm/md/lg), border radius, and token-based colors automatically.
Every button that triggers an async action needs a loading state. A spinner inside the button, a disabled cursor, and reduced opacity communicate clearly that something is happening. Skipping this leads to double-submit bugs and confused users. Similarly, disabled states need to pass WCAG 4.5:1 contrast even when muted — use opacity-50 plus pointer-events-none rather than a visually invisible color. Developers copy these patterns from component libraries, so the examples you show directly shape what gets shipped into apps.
Developers choose UI libraries that reduce thinking time. The three-second rule applies: if a developer cannot find the code they want within three seconds of landing on a component page, they leave. Showing live preview, JSX code, and one-click copy reduces friction. Providing separate Tailwind, React, and vanilla HTML tabs doubles the audience. Libraries that only show screenshots lose to libraries that let you see the component running, inspect its code, and paste it without leaving the browser.
In 2026, shipping only a light-mode button is incomplete. Dark mode is default on many developer machines and in many SaaS dashboards. Token-based color systems solve this cleanly: instead of hardcoding bg-blue-600, use a CSS variable like var(--color-primary) that switches automatically between modes. Button hover states, focus rings, and shadow opacity all need separate values for dark mode. Libraries that demo both modes simultaneously let developers verify their buttons look right before copying the code.
Square icon-only buttons and icon-plus-label buttons cover a large portion of dashboard UI — toolbars, action menus, data table controls, and top bars. Define a consistent icon size relative to the button size: 16px icon in a 36px button, 20px icon in a 44px button. Add aria-label to icon-only buttons for screen readers. When showing examples, display the icon name alongside the component so developers know which Lucide or Heroicon glyph to import. Copy speed matters most when the audience already knows the icon they want.
Ready to use these patterns?
Browse 400+ ready-to-copy React & Tailwind components.
Explore Component LibraryRelated Articles