Vector Motion
Medical

Fall Risk Card - Patient Safety

Monitor patient fall risk assessments and prevention measures. Track fall incidents and safety protocols.

Fall Risk Card

The Fall Risk Card Track patient fall risk assessments and prevention measures.

Preview

Installation

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

Fall Risk Card
'use client'import React from 'react';import { AlertOctagon, ShieldAlert, Activity } from 'lucide-react';import { motion } from 'motion/react';import { clsx, type ClassValue } from "clsx";import { twMerge } from "tailwind-merge";import { BarChart, Bar, Cell, ResponsiveContainer } from 'recharts';function cn(...inputs: ClassValue[]) {   return twMerge(clsx(inputs));}interface RiskLevel {   level: string;   count: number;   color: string;   [key: string]: any;}interface FallRiskCardProps {   className?: string;   title?: string;   subtitle?: string;   highRiskCount?: number;   precautionsActive?: boolean;   data?: RiskLevel[];}const DEFAULT_DATA: RiskLevel[] = [   { level: 'High', count: 8, color: '#f97316' },  // orange-500   { level: 'Med', count: 12, color: '#facc15' },  // yellow-400   { level: 'Low', count: 24, color: '#10b981' },  // emerald-500];const DEFAULT_TITLE = "Fall Risk";const DEFAULT_SUBTITLE = "Unit Assessment";const DEFAULT_HIGH_RISK_COUNT = 8;const DEFAULT_PRECAUTIONS_ACTIVE = true;export const FallRiskCard: React.FC<FallRiskCardProps> = ({   className = "",   title = DEFAULT_TITLE,   subtitle = DEFAULT_SUBTITLE,   highRiskCount = DEFAULT_HIGH_RISK_COUNT,   precautionsActive = DEFAULT_PRECAUTIONS_ACTIVE,   data = DEFAULT_DATA,}) => {   const isInteractive = true;   const index = 25;   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-orange-300 dark:hover:border-orange-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-orange-500"></span>                     </span>                     <p className="text-sm text-muted-foreground font-medium">                        {subtitle}                     </p>                  </div>               </div>               <div className="rounded-xl bg-orange-500/10 p-2.5 text-orange-500 flex items-center justify-center ring-1 ring-orange-100 dark:ring-orange-800">                  <AlertOctagon className="h-5 w-5" />               </div>            </div>            <div className="flex-1 flex flex-col">               <div className="flex items-center gap-4 mb-4">                  <div className="h-16 w-16 rounded-2xl bg-orange-500/10 border border-orange-100 dark:border-orange-900/30 flex flex-col items-center justify-center p-2">                     <span className="text-3xl font-bold text-orange-500">{highRiskCount}</span>                     <span className="text-[9px] uppercase font-bold text-orange-600/70">High Risk</span>                  </div>                  <div>                     <p className="text-xs text-muted-foreground mb-1">Active Monitoring</p>                     <div className="flex items-center gap-1.5 text-xs font-semibold text-zinc-800 dark:text-zinc-200">                        <ShieldAlert className="h-3.5 w-3.5 text-muted-foreground" />                        {precautionsActive ? "Precautions active" : "Check protocols"}                     </div>                  </div>               </div>               <div className="flex-1 relative mt-auto">                  <p className="text-[10px] text-zinc-400 font-bold uppercase mb-2">Patient Distribution</p>                  <div className="h-16 w-full">                     <ResponsiveContainer width="100%" height="100%">                        <BarChart data={data} layout="vertical">                           <Bar dataKey="count" radius={[0, 4, 4, 0]} barSize={10}>                              {data.map((entry, index) => (                                 <Cell key={`cell-${index}`} fill={entry.color} />                              ))}                           </Bar>                        </BarChart>                     </ResponsiveContainer>                  </div>                  <div className="flex justify-between px-1 text-[10px] text-muted-foreground -mt-2">                     <span>High</span>                     <span>Med</span>                     <span>Low</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