Özhan Gebeşoğlu

Lamp Toggle - Theme Switcher

Component

About

Beautiful animated lamp component for theme switching with Framer Motion

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Lamp Toggle - Theme Switcher to your project and fits it to your theme.

Code

How Lamp Toggle - Theme Switcher is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

// Demo showing different sizes of the lamp component
// This shows the versatility of the component

import { Component } from "@/components/ui/lamp-toggle-theme-switcher";
import { useState } from "react";

export default function SizeDemo() {
  const [isDark, setIsDark] = useState(false);

  const toggleTheme = () => setIsDark(!isDark);

  return (
    <div className={`min-h-screen p-8 transition-all duration-500 ${
      isDark ? 'bg-gray-900 text-white' : 'bg-white text-gray-900'
    }`}>
      <div className="text-center mb-12">
        <h1 className="text-4xl font-bold mb-4">🏮 Size Variations</h1>
        <p className="text-lg opacity-80">
          Click any lamp to toggle the theme and see all sizes in action!
        </p>
      </div>
      
      <div className="grid grid-cols-1 md:grid-cols-3 gap-12 max-w-6xl mx-auto">
        {/* Small Size */}
        <div className="text-center">
          <div className="relative h-32 flex items-center justify-center">
            <Component 
              isDark={isDark}
              onToggle={toggleTheme}
              size="small"
              className="relative top-0 left-0 transform-none"
            />
          </div>
          <h3 className="text-xl font-semibold mt-4">Small</h3>
          <p className="text-sm opacity-70 mt-2">
            Perfect for compact interfaces and mobile layouts
          </p>
          <div className="mt-4 text-xs opacity-60">
            <div>Width: 8rem (128px)</div>
            <div>Height: 1.5rem (24px)</div>
            <div>Cable: 20px</div>
          </div>
        </div>

        {/* Medium Size */}
        <div className="text-center">
          <div className="relative h-32 flex items-center justify-center">
            <Component 
              isDark={isDark}
              onToggle={toggleTheme}
              size="medium"
              className="relative top-0 left-0 transform-none"
            />
          </div>
          <h3 className="text-xl font-semibold mt-4">Medium</h3>
          <p className="text-sm opacity-70 mt-2">
            Default size, great for most desktop applications
          </p>
          <div className="mt-4 text-xs opacity-60">
            <div>Width: 14rem (224px)</div>
            <div>Height: 2.5rem (40px)</div>
            <div>Cable: 30px</div>
          </div>
        </div>

        {/* Large Size */}
        <div className="text-center">
          <div className="relative h-32 flex items-center justify-center">
            <Component 
              isDark={isDark}
              onToggle={toggleTheme}
              size="large"
              className="relative top-0 left-0 transform-none"
            />
          </div>
          <h3 className="text-xl font-semibold mt-4">Large</h3>
          <p className="text-sm opacity-70 mt-2">
            Bold and prominent, ideal for hero sections
          </p>
          <div className="mt-4 text-xs opacity-60">
            <div>Width: 20rem (320px)</div>
            <div>Height: 3.5rem (56px)</div>
            <div>Cable: 40px</div>
          </div>
        </div>
      </div>

      <div className="mt-16 text-center">
        <div className={`inline-flex items-center gap-2 px-4 py-2 rounded-full ${
          isDark ? 'bg-gray-800 text-gray-300' : 'bg-gray-100 text-gray-700'
        }`}>
          <div className={`w-3 h-3 rounded-full ${isDark ? 'bg-blue-400' : 'bg-yellow-400'}`}></div>
          Current Theme: <strong>{isDark ? 'Dark' : 'Light'}</strong>
        </div>
      </div>
    </div>
  );
}

Dependencies

More by Özhan Gebeşoğlu

View all
  • Parallax Card Grid

    Parallax Card Grid