Vector Motion
Medical

Mental Health Card - Behavioral Health

Monitor mental health services and patient outcomes. Track behavioral health metrics and treatment progress.

Mental Health Card

The Mental Health Card Track mental health patient assessments and treatment progress.

Preview

Installation

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

Mental Health Card
'use client'import React from 'react';import { Brain, Sun, Sparkles } from 'lucide-react';import { motion } from 'motion/react';import { clsx, type ClassValue } from "clsx";import { twMerge } from "tailwind-merge";import { RadialBarChart, RadialBar, PolarAngleAxis, ResponsiveContainer } from 'recharts';function cn(...inputs: ClassValue[]) {   return twMerge(clsx(inputs));}interface MentalHealthData {   name: string;   value: number;   fill: string;   [key: string]: any;}interface MentalHealthCardProps {   className?: string;   title?: string;   subtitle?: string;   wellnessScore?: number;   bedsOccupied?: string;   consults?: number;   data?: MentalHealthData[];}const DEFAULT_DATA: MentalHealthData[] = [{ name: 'Wellness', value: 78, fill: '#8b5cf6' }];const DEFAULT_TITLE = "Psychiatry";const DEFAULT_SUBTITLE = "Wellness Score";const DEFAULT_WELLNESS_SCORE = 78;const DEFAULT_BEDS_OCCUPIED = "18/20";const DEFAULT_CONSULTS = 2;export const MentalHealthCard: React.FC<MentalHealthCardProps> = ({   className = "",   title = DEFAULT_TITLE,   subtitle = DEFAULT_SUBTITLE,   wellnessScore = DEFAULT_WELLNESS_SCORE,   bedsOccupied = DEFAULT_BEDS_OCCUPIED,   consults = DEFAULT_CONSULTS,   data = DEFAULT_DATA,}) => {   const isInteractive = true;   const index = 31;   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">                  <Brain className="h-5 w-5" />               </div>            </div>            <div className="flex-1 flex flex-col items-center justify-center relative">               <div className="h-32 w-full relative">                  <ResponsiveContainer width="100%" height="100%">                     <RadialBarChart                        cx="50%"                        cy="50%"                        innerRadius="70%"                        outerRadius="100%"                        barSize={10}                        data={data}                        startAngle={90}                        endAngle={-270}                     >                        <PolarAngleAxis type="number" domain={[0, 100]} angleAxisId={0} tick={false} />                        <RadialBar background dataKey="value" cornerRadius={10} />                     </RadialBarChart>                  </ResponsiveContainer>                  <div className="absolute inset-0 flex flex-col items-center justify-center">                     <span className="text-3xl font-bold text-foreground">{wellnessScore}</span>                     <div className="flex items-center gap-1 text-[10px] text-muted-foreground font-medium uppercase">                        <Sparkles className="h-3 w-3 text-amber-400" /> Avg                     </div>                  </div>               </div>               <div className="w-full mt-2 grid grid-cols-2 gap-2">                  <div className="text-center p-1.5 bg-muted rounded-lg">                     <span className="block text-xs font-bold text-zinc-800 dark:text-zinc-200">{bedsOccupied}</span>                     <span className="text-[9px] text-muted-foreground uppercase">Beds</span>                  </div>                  <div className="text-center p-1.5 bg-muted rounded-lg">                     <span className="block text-xs font-bold text-zinc-800 dark:text-zinc-200">{consults}</span>                     <span className="text-[9px] text-muted-foreground uppercase">Consults</span>                  </div>               </div>            </div>         </div>      </motion.div>   );};

Usage

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

Prop

Type