Here's a Shadcn UI component that meets your requirements. This includes a rainbow gradient button to display content and a black upload button:
import { useState } from "react";
import { Button } from "@/components/ui/button";
export default function ImageDisplayComponent() {
const [showContent, setShowContent] = useState(false);
const handleUpload = () => {
// Add your image upload logic here
console.log("Upload functionality would go here");
};
return (
<div className="max-w-md mx-auto p-6 space-y-6">
{/* Rainbow Gradient Button */}
<Button
onClick={() => setShowContent(true)}
className="w-full py-6 text-lg font-bold text-white shadow-lg"
style={{
background: "linear-gradient(90deg, #ff0000, #ff8000, #ffff00, #80ff00, #00ff00, #00ff80, #00ffff, #0080ff, #0000ff, #8000ff, #ff00ff, #ff0080)",
backgroundSize: "1200% 100%",
animation: "rainbow 3s linear infinite"
}}
>
Click Me!
</Button>
{/* Image and Text Display */}
{showContent && (
<div className="animate-fadeIn">
<img
src="https://via.placeholder.com/300"
alt="Display"
className="rounded-lg border shadow-md w-full"
/>
<p className="mt-3 text-center text-gray-700">
This is the text displayed below the image
</p>
</div>
)}
{/* Upload Button */}
<Button
onClick={handleUpload}
className="w-full bg-black hover:bg-gray-900 text-white py-6 text-lg"
>
Upload Image & Text
</Button>
{/* Rainbow Animation Styles */}
<style jsx>{`
@keyframes rainbow {
0% { background-position: 0% 50% }
100% { background-position: 100% 50% }
}
`}</style>
</div>
);
}
To use this component:
- Make sure you have Shadcn UI properly set up in your project
- Create a new component file (e.g.,
ImageDisplay.tsx) and paste this code
- Import and use it in your page:
import ImageDisplayComponent from "@/components/ImageDisplay";
export default function Home() {
return (
<div className="container mx-auto py-12">
<ImageDisplayComponent />
</div>
);
}
Key features:
- Rainbow animated button with gradient animation
- Image and text appear when clicking the rainbow button
- Smooth fade-in animation for content
- Black upload button with hover effect
- Responsive design
- Clean layout with proper spacing
The component includes:
- A rainbow gradient button with animated color transition
- Image display with text below it when the first button is clicked
- A black upload button that triggers the upload functionality
- Smooth animations for better user experience
To implement actual image upload functionality, you would need to:
- Add a file input handler
- Implement upload logic (e.g., to a cloud storage service)
- Add state management for the uploaded image
- Implement text input handling if you want editable text
The rainbow button uses:
- CSS gradient with 12 colors
- Animation that cycles through the gradient
- Large click area with bold text
- Shadow for depth
The black upload button:
- Pure black background
- Darker hover state
- Large touch target
- Consistent styling with the first button
You can customize:
- Image source by replacing the placeholder URL
- Text content
- Colors in the gradient
- Animation speed
- Button sizes
- Spacing and padding