Ravi Katiyar

Download Card

Cards 57

About

Download Card This component displays download options and visual feedback for different states like loading and success, driven by props.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Download Card to your project and fits it to your theme.

Code

How Download Card is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

import React, { useState } from "react";
import { Video, Music, FileImage } from "lucide-react";
import { DownloadCard } from "@/components/ui/download-card"; // Adjust the import path
import { Button } from "@/components/ui/button"; // Optional: For control buttons

type Status = "idle" | "loading" | "success";

export default function DownloadCardDemo() {
  const [status, setStatus] = useState<Status>("idle");

  // Simulate a download process
  const handleDownload = () => {
    if (status !== 'idle') return; // Prevent multiple clicks

    setStatus("loading");

    // Simulate rendering time
    setTimeout(() => {
      setStatus("success");

      // Reset back to idle after showing success message
      setTimeout(() => {
        setStatus("idle");
      }, 2500);
    }, 3000);
  };

  const downloadFormats = [
    {
      name: "MP4",
      icon: <Video className="h-6 w-6" />,
      onSelect: handleDownload,
    },
    {
      name: "MP3",
      icon: <Music className="h-6 w-6" />,
      onSelect: handleDownload,
    },
    {
      name: "GIF",
      icon: <FileImage className="h-6 w-6" />,
      onSelect: handleDownload,
    },
  ];

  return (
    <div className="flex flex-col items-center justify-center space-y-6 rounded-lg bg-muted p-8">
       <DownloadCard
        status={status}
        formats={downloadFormats}
      />

      {/* Optional: Buttons to manually control the state for testing */}
      <div className="flex space-x-2 pt-4">
         <Button variant="outline" size="sm" onClick={() => setStatus("idle")} disabled={status !== 'idle'}>
            Reset to Idle
         </Button>
      </div>
    </div>
  );
}

Dependencies

More by Ravi Katiyar

View all
  • Animated Shader Hero

    Animated Shader Hero

    3.7K
  • Hero

    Hero

    3.1K
  • Circular Gallery

    Circular Gallery

    2.8K
  • Minimalist Hero

    Minimalist Hero

    2.6K
  • Floating Icons Hero Section

    Floating Icons Hero Section

    1.9K
  • Glass Calendar

    Glass Calendar

    1.8K
  • Feature Carousel

    Feature Carousel

    1.7K
  • AI Image Generator Hero

    AI Image Generator Hero

    1.4K

More in Cards

View all
  • Course Design Cards

    Course Design Cards

    1.1K
  • Statistics Card 2

    Statistics Card 2

    269
  • Statistics Card 7

    Statistics Card 7

    295
  • Card

    Card

    56
  • Stats cards with links

    Stats cards with links

    86
  • Interactive Tech Stack Bento Grid with Hover Effects

    Interactive Tech Stack Bento Grid with Hover Effects

    99
  • The Item one

    The Item one

    3
  • Card Studio

    Card Studio

    36