Buttons

Interactive button designs with various hover states and animations

Live Preview
Desktop preview
Live updating

Your Claude Code/Cursor prompt

Send prompt + React component to Claude Code

Create modern interactive buttons with hover effects and animations. Requirements:
- React + TypeScript + Tailwind CSS
- Multiple button variants (primary, secondary, outlined)
- Hover animations with scale and color transitions
- Light and dark mode support
- Accessibility compliant (WCAG 2.1 AA)
- Loading states and disabled states
- Responsive design
- Smooth transitions using CSS transforms

Custom Theme Colors:
- Primary: #00ff88
- Secondary: #00e5ff
- Accent: #4ade80
- Background: #0f172a
...
Color Presets:
React Component
// Button Component with Hover Effects
import { motion } from 'framer-motion'
import { ButtonHTMLAttributes } from 'react'

interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
  variant?: 'primary' | 'secondary' | 'outlined'
  size?: 'sm' | 'md' | 'lg'
  loading?: boolean
  theme?: 'light' | 'dark'
}

export default function InteractiveButton({ 
  variant = 'primary', 
  size = 'md', 
  loading = false,
  theme = 'dark',
  children,
  className,
  ...props 
}: ButtonProps) {
  const baseClasses = `
    relative overflow-hidden font-semibold rounded-lg 
    transition-all duration-200 transform
    focus:outline-none focus:ring-2 focus:ring-offset-2
    disabled:opacity-50 disabled:cursor-not-allowed
    hover:scale-105 active:scale-95
  `

  const variants = {
    primary: theme === 'dark' 
      ? 'bg-gradient-to-r from-ui-primary-500 to-ui-secondary-500 text-black hover:shadow-lg hover:shadow-ui-primary-500/25'
      : 'bg-gradient-to-r from-ui-primary-700 to-ui-secondary-700 text-white hover:shadow-lg hover:shadow-ui-primary-700/25',
    secondary: theme === 'dark'
      ? 'bg-ui-bg-800 text-white border border-ui-bg-700 hover:bg-ui-bg-700 hover:border-ui-primary-500'
      : 'bg-white text-ui-bg-950 border border-ui-bg-200 hover:bg-ui-bg-50 hover:border-ui-primary-700',
    outlined: theme === 'dark'
      ? 'border-2 border-ui-primary-500 text-ui-primary-500 hover:bg-ui-primary-500 hover:text-black'
      : 'border-2 border-ui-primary-700 text-ui-primary-700 hover:bg-ui-primary-700 hover:text-white'
  }

  const sizes = {
    sm: 'px-3 py-1.5 text-sm',
    md: 'px-4 py-2 text-base',
    lg: 'px-6 py-3 text-lg'
  }

  return (
    <motion.button
      whileHover={{ scale: 1.05 }}
      whileTap={{ scale: 0.95 }}
      className={`${baseClasses} ${variants[variant]} ${sizes[size]} ${className}`}
      disabled={loading}
      {...props}
    >
      {/* Shine Effect */}
      <div className="absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent -translate-x-full hover:translate-x-full transition-transform duration-1000"></div>
      
      {/* Content */}
      <span className="relative z-10 flex items-center gap-2">
        {loading && (
          <div className="w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"></div>
        )}
        {children}
      </span>
    </motion.button>
  )
}

// Usage Examples
export function ButtonShowcase({ theme = 'dark' }) {
  return (
    <div className="space-y-6">
      <div className="flex flex-wrap gap-4">
        <InteractiveButton variant="primary" theme={theme}>
          Primary Button
        </InteractiveButton>
        <InteractiveButton variant="secondary" theme={theme}>
          Secondary Button
        </InteractiveButton>
        <InteractiveButton variant="outlined" theme={theme}>
          Outlined Button
        </InteractiveButton>
      </div>
      
      <div className="flex flex-wrap gap-4">
        <InteractiveButton size="sm" theme={theme}>Small</InteractiveButton>
        <InteractiveButton size="md" theme={theme}>Medium</InteractiveButton>
        <InteractiveButton size="lg" theme={theme}>Large</InteractiveButton>
      </div>
      
      <div className="flex flex-wrap gap-4">
        <InteractiveButton loading theme={theme}>
          Loading
        </InteractiveButton>
        <InteractiveButton disabled theme={theme}>
          Disabled
        </InteractiveButton>
      </div>
    </div>
  )
}
Need help? 👋