Vector Motion
Education

Enrollment Stats Card - Student Population

Monitor enrollment numbers and student population trends. Track grade level distribution and enrollment growth.

Enrollment Stats Card

The Enrollment Stats Card displays total student enrollment with year-over-year growth metrics and academic year information.

Preview

Installation

npx shadcn@latest add https://vectormotion.vercel.app/registry/enrollment-stats-card.json
Enrollment Stats Card
'use client'import React from 'react';import { Users } from 'lucide-react';import { motion } from 'motion/react';import { clsx, type ClassValue } from "clsx";import { twMerge } from "tailwind-merge";import { ResponsiveContainer, AreaChart, Area, XAxis, Tooltip } from 'recharts';function cn(...inputs: ClassValue[]) {  return twMerge(clsx(inputs));}interface EnrollmentData {  year: string;  students: number;  [key: string]: any;}interface EnrollmentStatsCardProps {  className?: string;  title?: string;  subtitle?: string;  totalStudents?: string;  trend?: string;  data?: EnrollmentData[];}const DEFAULT_DATA: EnrollmentData[] = [  { year: '2020', students: 1050 },  { year: '2021', students: 1100 },  { year: '2022', students: 1150 },  { year: '2023', students: 1180 },  { year: '2024', students: 1240 },];const DEFAULT_TITLE = "Enrollment";const DEFAULT_SUBTITLE = "Total Students";const DEFAULT_TOTAL_STUDENTS = "1,240";const DEFAULT_TREND = "+5.2% YoY";export const EnrollmentStatsCard: React.FC<EnrollmentStatsCardProps> = ({  className = "",  title = DEFAULT_TITLE,  subtitle = DEFAULT_SUBTITLE,  totalStudents = DEFAULT_TOTAL_STUDENTS,  trend = DEFAULT_TREND,  data = DEFAULT_DATA,}) => {  return (    <motion.div      initial={{ opacity: 0, y: 20 }}      animate={{ opacity: 1, y: 0 }}      transition={{ duration: 0.5, delay: 0.4 }}      className={cn(        "relative overflow-hidden rounded-2xl border border-border bg-card text-card-foreground shadow-sm transition-all hover:border-indigo-300 dark:hover:border-indigo-700 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>            <div className="flex items-center gap-2 mt-1">              <span className="text-2xl font-bold text-foreground">{totalStudents}</span>              <span className="text-xs font-medium text-emerald-500 bg-emerald-500/10 px-1.5 py-0.5 rounded-full">                {trend}              </span>            </div>            <p className="text-sm text-muted-foreground mt-1">              {subtitle}            </p>          </div>          <div className="rounded-xl bg-indigo-50 dark:bg-indigo-900/20 p-2.5 text-indigo-500 dark:text-indigo-400 flex items-center justify-center ring-1 ring-indigo-100 dark:ring-indigo-800">            <Users className="h-5 w-5" />          </div>        </div>        <div className="flex-1 w-full min-h-[100px]">          <ResponsiveContainer width="100%" height="100%">            <AreaChart data={data}>              <defs>                <linearGradient id="enrollmentGradient" x1="0" y1="0" x2="0" y2="1">                  <stop offset="5%" stopColor="#6366f1" stopOpacity={0.3} />                  <stop offset="95%" stopColor="#6366f1" stopOpacity={0} />                </linearGradient>              </defs>              <XAxis                dataKey="year"                axisLine={false}                tickLine={false}                tick={{ fontSize: 10, fill: '#71717a' }}                tickMargin={8}              />              <Tooltip cursor={false} content={() => null} />              <Area                type="monotone"                dataKey="students"                stroke="#6366f1"                strokeWidth={2}                fill="url(#enrollmentGradient)"              />            </AreaChart>          </ResponsiveContainer>        </div>        <div className="absolute -bottom-4 -right-4 z-0 opacity-5 pointer-events-none">          <Users className="w-32 h-32 text-indigo-500" />        </div>      </div>    </motion.div>  );};

Usage

This component provides key enrollment metrics, helping administrators understand student population trends and growth.

Prop

Type