Vector Motion
Education

Course Progress Card - Learning Analytics

Monitor student course progress and completion rates. Track course advancement and milestone achievements.

Course Progress Card

The Course Progress Card displays progress for multiple courses with visual progress bars showing completion percentages.

Preview

Installation

npx shadcn@latest add https://vectormotion.vercel.app/registry/course-progress-card.json
Course Progress Card
'use client'import React from 'react';import { GraduationCap } from 'lucide-react';import { motion } from 'motion/react';import { clsx, type ClassValue } from "clsx";import { twMerge } from "tailwind-merge";import { ResponsiveContainer, RadialBarChart, RadialBar, Tooltip } from 'recharts';function cn(...inputs: ClassValue[]) {   return twMerge(clsx(inputs));}interface CourseProgressData {   name: string;   progress: number;   fill: string;   [key: string]: any;}interface CourseProgressCardProps {   className?: string;   title?: string;   subtitle?: string;   averageProgress?: string;   averageLabel?: string;   data?: CourseProgressData[];}const DEFAULT_DATA: CourseProgressData[] = [   { name: 'Physics', progress: 45, fill: '#f472b6' },   { name: 'Math', progress: 80, fill: '#60a5fa' },   { name: 'CS', progress: 95, fill: '#34d399' },];const DEFAULT_TITLE = "Progress";const DEFAULT_SUBTITLE = "Course Completion";const DEFAULT_AVERAGE_PROGRESS = "73%";const DEFAULT_AVERAGE_LABEL = "Avg";export const CourseProgressCard: React.FC<CourseProgressCardProps> = ({   className = "",   title = DEFAULT_TITLE,   subtitle = DEFAULT_SUBTITLE,   averageProgress = DEFAULT_AVERAGE_PROGRESS,   averageLabel = DEFAULT_AVERAGE_LABEL,   data = DEFAULT_DATA,}) => {   return (      <motion.div         initial={{ opacity: 0, y: 20 }}         animate={{ opacity: 1, y: 0 }}         transition={{ duration: 0.5, delay: 0.1 }}         className={cn(            "relative overflow-hidden rounded-2xl border border-border bg-card text-card-foreground shadow-sm transition-all hover:border-primary/50 hover:shadow-md flex flex-col h-full",            className         )}      >         <div className="p-5 flex flex-col h-full relative z-10">            <div className="mb-4 flex items-start justify-between">               <div>                  <h3 className="font-bold text-lg text-foreground">                     {title}                  </h3>                  <p className="text-sm text-muted-foreground font-medium">                     {subtitle}                  </p>               </div>               <div className="rounded-xl bg-blue-500/10 p-2.5 text-blue-500 dark:text-blue-400 flex items-center justify-center ring-1 ring-blue-100 dark:ring-blue-800">                  <GraduationCap className="h-5 w-5" />               </div>            </div>            <div className="flex-1 w-full min-h-[120px] relative">               <ResponsiveContainer width="100%" height="100%">                  <RadialBarChart                     cx="50%"                     cy="50%"                     innerRadius="30%"                     outerRadius="100%"                     barSize={10}                     data={data}                     startAngle={90}                     endAngle={450}                  >                     <RadialBar                        background                        dataKey="progress"                        cornerRadius={10}                     />                     <Tooltip cursor={false} content={() => null} />                  </RadialBarChart>               </ResponsiveContainer>               <div className="absolute inset-0 flex items-center justify-center pointer-events-none">                  <div className="text-center">                     <span className="text-xl font-bold text-foreground">{averageProgress}</span>                     <p className="text-[9px] text-muted-foreground uppercase tracking-wider">{averageLabel}</p>                  </div>               </div>            </div>         </div>         <div className="absolute -bottom-4 -right-4 z-0 opacity-5 pointer-events-none">            <GraduationCap className="w-32 h-32 text-blue-500" />         </div>      </motion.div>   );};

Usage

This component helps students and educators track progress across multiple courses, providing a clear overview of completion status.

Prop

Type