Education
At-Risk Students Card - Student Support
Identify and track at-risk students needing intervention. Monitor academic warning flags and support program effectiveness.
At Risk Students Card
The At Risk Students Card displays students who may need intervention, showing the reason for concern (attendance, grades, etc.).
Preview
Installation
npx shadcn@latest add https://vectormotion.vercel.app/registry/at-risk-students-card.jsonAt Risk Students Card
'use client'import React from 'react';import { AlertCircle } 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 RiskData { name: string; count: number; fill: string; [key: string]: any;}interface AtRiskStudentsCardProps { className?: string; title?: string; subtitle?: string; total?: string; data?: RiskData[];}const DEFAULT_DATA: RiskData[] = [ { name: 'High Risk', count: 12, fill: '#ef4444' }, { name: 'Medium Risk', count: 25, fill: '#f59e0b' }, { name: 'Low Risk', count: 45, fill: '#10b981' },];const DEFAULT_TITLE = "Risk Analysis";const DEFAULT_SUBTITLE = "Intervention Needed";const DEFAULT_TOTAL = "82";export const AtRiskStudentsCard: React.FC<AtRiskStudentsCardProps> = ({ className = "", title = DEFAULT_TITLE, subtitle = DEFAULT_SUBTITLE, total = DEFAULT_TOTAL, data = DEFAULT_DATA,}) => { return ( <motion.div initial={{ opacity: 0, y: 20 }} animate={{ opacity: 1, y: 0 }} transition={{ duration: 0.5, delay: 0.2 }} className={cn( "relative overflow-hidden rounded-2xl border border-border bg-card text-card-foreground shadow-sm transition-all hover:border-red-300 dark:hover:border-red-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> <p className="text-sm text-muted-foreground font-medium"> {subtitle} </p> </div> <div className="rounded-xl bg-red-50 dark:bg-red-900/20 p-2.5 text-red-500 dark:text-red-400 flex items-center justify-center ring-1 ring-red-100 dark:ring-red-800"> <AlertCircle 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="40%" outerRadius="100%" barSize={10} data={data} startAngle={90} endAngle={450} > <RadialBar background dataKey="count" cornerRadius={10} /> <Tooltip cursor={false} content={({ active, payload }) => { if (active && payload && payload.length) { return ( <div className="rounded-lg border border-zinc-200 dark:border-zinc-700 bg-white dark:bg-zinc-800 p-2 shadow-sm text-xs"> <span className="font-bold">{payload[0].payload.name}:</span> {payload[0].value} </div> ); } return null; }} /> </RadialBarChart> </ResponsiveContainer> <div className="absolute inset-0 flex items-center justify-center pointer-events-none"> <div className="text-center"> <span className="text-2xl font-bold text-foreground">{total}</span> <p className="text-[10px] text-muted-foreground uppercase tracking-wider">Total</p> </div> </div> </div> </div> </motion.div> );};Usage
This component helps educators quickly identify students who may need additional support or intervention, enabling proactive assistance.
Prop
Type