Vector Motion
Medical

Lab Results Card - Laboratory Services

Monitor laboratory test results and reporting. Track lab turnaround times and quality metrics.

Lab Results Card

The Lab Results Card Track laboratory test results and turnaround times.

Preview

Installation

ash npx shadcn@latest add https://vectormotion.vercel.app/registry/lab-results-card.json

Lab Results Card
'use client'import React from 'react';import { FlaskConical, Clock, CheckCircle2, AlertCircle } from 'lucide-react';import { motion } from 'motion/react';import { clsx, type ClassValue } from "clsx";import { twMerge } from "tailwind-merge";import { BarChart, Bar, XAxis, Tooltip, ResponsiveContainer, Cell } from 'recharts';function cn(...inputs: ClassValue[]) {   return twMerge(clsx(inputs));}interface LabData {   name: string;   value: number;   fill: string;   [key: string]: any;}interface LabResultsCardProps {   className?: string;   title?: string;   subtitle?: string;   pendingCount?: number;   readyCount?: number;   alertMessage?: string;   data?: LabData[];}const DEFAULT_DATA: LabData[] = [   { name: 'Hem', value: 24, fill: '#8b5cf6' }, // violet-500   { name: 'Bio', value: 18, fill: '#3b82f6' }, // blue-500   { name: 'Micro', value: 8, fill: '#10b981' }, // emerald-500];const DEFAULT_TITLE = "Lab Results";const DEFAULT_SUBTITLE = "Pathology Queue";const DEFAULT_PENDING_COUNT = 12;const DEFAULT_READY_COUNT = 45;const DEFAULT_ALERT_MESSAGE = "Tat < 45m";export const LabResultsCard: React.FC<LabResultsCardProps> = ({   className = "",   title = DEFAULT_TITLE,   subtitle = DEFAULT_SUBTITLE,   pendingCount = DEFAULT_PENDING_COUNT,   readyCount = DEFAULT_READY_COUNT,   alertMessage = DEFAULT_ALERT_MESSAGE,   data = DEFAULT_DATA,}) => {   const isInteractive = true;   const index = 6;   return (      <motion.div         layoutId={isInteractive ? `card-${index}-${title}` : undefined}         transition={{ duration: 0.4, ease: "easeOut" }}         className={cn(            "relative overflow-hidden rounded-2xl border border-border bg-card text-card-foreground shadow-sm transition-all flex flex-col h-full",            isInteractive ? "hover:border-violet-300 dark:hover:border-violet-700 hover:shadow-md" : "",            className         )}      >         <div className="p-5 flex flex-col h-full relative z-10">            <div className="mb-2 flex items-start justify-between">               <div>                  <h3 className="font-bold text-lg text-foreground">                     {title}                  </h3>                  <div className="flex items-center gap-1.5 mt-1">                     <span className="relative flex h-2 w-2">                        <span className="relative inline-flex rounded-full h-2 w-2 bg-violet-500"></span>                     </span>                     <p className="text-sm text-muted-foreground font-medium">                        {subtitle}                     </p>                  </div>               </div>               <div className="rounded-xl bg-violet-500/10 p-2.5 text-violet-500 flex items-center justify-center ring-1 ring-violet-100 dark:ring-violet-800">                  <FlaskConical className="h-5 w-5" />               </div>            </div>            <div className="flex-1 flex flex-col gap-4">               <div className="flex gap-3">                  <div className="flex-1 p-3 rounded-xl bg-amber-50 dark:bg-amber-900/10 border border-amber-100 dark:border-amber-900/30 flex flex-col items-center justify-center">                     <div className="flex items-center gap-1.5 mb-1">                        <Clock className="h-3.5 w-3.5 text-amber-500" />                        <span className="text-[10px] font-bold text-amber-500 uppercase tracking-wide">Pending</span>                     </div>                     <span className="text-2xl font-bold text-foreground">{pendingCount}</span>                  </div>                  <div className="flex-1 p-3 rounded-xl bg-emerald-50 dark:bg-emerald-900/10 border border-emerald-100 dark:border-emerald-900/30 flex flex-col items-center justify-center">                     <div className="flex items-center gap-1.5 mb-1">                        <CheckCircle2 className="h-3.5 w-3.5 text-emerald-500" />                        <span className="text-[10px] font-bold text-emerald-500 uppercase tracking-wide">Ready</span>                     </div>                     <span className="text-2xl font-bold text-foreground">{readyCount}</span>                  </div>               </div>               <div className="flex-1 min-h-[60px]">                  <p className="text-[10px] text-zinc-400 font-bold uppercase mb-1">Department Volume</p>                  <ResponsiveContainer width="100%" height="100%">                     <BarChart data={data} layout="vertical" barSize={12}>                        <XAxis type="number" hide />                        <Bar dataKey="value" radius={[0, 4, 4, 0]}>                           {data.map((entry, index) => (                              <Cell key={`cell-${index}`} fill={entry.fill} />                           ))}                        </Bar>                     </BarChart>                  </ResponsiveContainer>                  <div className="flex justify-between px-1 text-[10px] text-muted-foreground -mt-2">                     <span>Hem</span>                     <span>Bio</span>                     <span>Micro</span>                  </div>               </div>            </div>            {/* Alert / Status */}            <div className="mt-3 flex items-center gap-2 text-xs text-muted-foreground bg-muted p-2 rounded-lg">               <AlertCircle className="h-3.5 w-3.5 text-muted-foreground" />               <span><span className="font-semibold text-foreground">{alertMessage}</span> for STAT labs</span>            </div>         </div>      </motion.div>   );};

Usage

This component is a demo card displaying medical metrics with animated visualizations and dark mode support.

Prop

Type