Vector Motion
AI/ML

Ground Truth Card - Model Training Data

Monitor ground truth data collection and labeling progress. Track training data quality and verify labels for supervised learning models.

Ground Truth Card

The Ground Truth Card displays ground truth labels and validation data used for model evaluation and performance measurement.

Preview

Installation

npx shadcn@latest add https://vectormotion.vercel.app/registry/ground-truth-card.json
Ground Truth Card
'use client'import React from 'react';import { Scale, CheckCircle2 } from 'lucide-react';import { motion } from 'motion/react';import { clsx, type ClassValue } from "clsx"import { twMerge } from "tailwind-merge"import { ResponsiveContainer, BarChart, Bar, XAxis, Tooltip, Cell } from 'recharts';function cn(...inputs: ClassValue[]) {  return twMerge(clsx(inputs))}interface GroundTruthData {  name: string;  count: number;  fill: string;  [key: string]: any;}interface GroundTruthCardProps {  className?: string;  title?: string;  labeledPercentage?: string;  statusLabel?: string;  data?: GroundTruthData[];  footerText?: string;}const DEFAULT_DATA: GroundTruthData[] = [  { name: '<1h', count: 450, fill: '#10b981' },  { name: '1-4h', count: 200, fill: '#3b82f6' },  { name: '>4h', count: 50, fill: '#f59e0b' },];const DEFAULT_TITLE = "Ground Truth";const DEFAULT_LABELED_PERCENTAGE = "92%";const DEFAULT_STATUS_LABEL = "Labeled";const DEFAULT_FOOTER_TEXT = "Feedback Latency";export const GroundTruthCard: React.FC<GroundTruthCardProps> = ({  className = "",  title = DEFAULT_TITLE,  labeledPercentage = DEFAULT_LABELED_PERCENTAGE,  statusLabel = DEFAULT_STATUS_LABEL,  data = DEFAULT_DATA,  footerText = DEFAULT_FOOTER_TEXT,}) => {  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-purple-300 dark:hover:border-purple-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">{labeledPercentage}</span>              <span className="text-xs font-medium text-emerald-500 bg-emerald-500/10 px-1.5 py-0.5 rounded-full flex items-center gap-1">                <CheckCircle2 className="w-3 h-3" />                {statusLabel}              </span>            </div>          </div>          <div className="rounded-lg border-2 border-purple-100 dark:border-purple-800 p-2 text-purple-500 dark:text-purple-400 flex items-center justify-center">            <Scale className="h-5 w-5" />          </div>        </div>        <div className="flex-1 w-full min-h-[100px] relative">          <ResponsiveContainer width="100%" height="100%">            <BarChart data={data}>              <XAxis                dataKey="name"                axisLine={false}                tickLine={false}                tick={{ fontSize: 10, fill: '#71717a' }}              />              <Tooltip                cursor={{ fill: 'transparent' }}                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 text-foreground">                          Lag {payload[0].payload.name}:                        </span> {payload[0].value} items                      </div>                    );                  }                  return null;                }}              />              <Bar dataKey="count" radius={[4, 4, 0, 0]} barSize={40}>                {data.map((entry, index) => (                  <Cell key={`cell-${index}`} fill={entry.fill} />                ))}              </Bar>            </BarChart>          </ResponsiveContainer>          <div className="text-center text-[10px] text-muted-foreground">{footerText}</div>        </div>        <div className="absolute -bottom-4 -right-4 z-0 opacity-5 pointer-events-none">          <Scale className="w-40 h-40 text-purple-500" />        </div>      </div>    </motion.div>  );};

Props

Prop

Type

Usage

This component is a demo card displaying ground truth information with animated visualizations and dark mode support.