Components/Buttons/Glass Morphism Button

Buttons

Glass Morphism Button

Frosted glass effect with backdrop blur and transparency

Color variant

Changes the live preview, the copy-ready snippet, and the accent line at the bottom of the code block.

Live preview

Code

glass-morphism-button.jsx
export function GlassMorphismButton({ children, variant = 'blue', ...props }) {
  const variants = {
    blue: 'bg-blue-500/20 border-blue-400/30 hover:bg-blue-500/30 shadow-[0_8px_32px_0_rgba(31,38,135,0.37)]',
    purple: 'bg-blue-500/20 border-blue-400/30 hover:bg-blue-500/30 shadow-[0_8px_32px_0_rgba(135,31,120,0.37)]',
    pink: 'bg-blue-500/20 border-blue-400/30 hover:bg-blue-500/30 shadow-[0_8px_32px_0_rgba(236,72,153,0.37)]',
    green: 'bg-blue-500/20 border-blue-400/30 hover:bg-blue-500/30 shadow-[0_8px_32px_0_rgba(34,197,94,0.37)]',
  };

  return (
    <button 
      className={`px-8 py-4 text-white font-bold rounded-xl backdrop-blur-lg border transition-all duration-300 hover:shadow-2xl transform hover:scale-105 ${variants[variant]}`}
      {...props}
    >
      {children}
    </button>
  );
}

/* ── Live preview accent: "blue" (variant prop + Tailwind above) ── */

Installation

No additional dependencies

Simply copy the code above and paste it into your project. Only React and Tailwind CSS are required.

Component Info

Category

Buttons

Dependencies

None