VectorMotion
E-Commerce

Active Users Card - Real-time Traffic Analytics

Track active users, concurrent visitors, and real-time traffic patterns. Monitor user engagement and session activity on your e-commerce platform.

Active Users Card

The Active Users Card Track real-time active user activity.

Preview

Installation

ash npx shadcn@latest add https://www.vectormotion.dev/registry/active-users-card.json

Active Users Card
'use client';import React from "react";import { Users, Activity } from "lucide-react";import { motion } from "motion/react";import { clsx, type ClassValue } from "clsx";import { twMerge } from "tailwind-merge";function cn(...inputs: ClassValue[]) {  return twMerge(clsx(inputs));}interface TimeData {  time: string;  users: number;  [key: string]: any;}interface ActiveUsersCardProps {  className?: string;  title?: string;  description?: string;  currentValue?: string;  valueDescription?: string;  timeData?: TimeData[];}const DEFAULT_TIME_DATA: TimeData[] = [  { time: "12PM", users: 1200 },  { time: "1PM", users: 1450 },  { time: "2PM", users: 1680 },  { time: "3PM", users: 1920 },  { time: "Now", users: 2150 },];const DEFAULT_TITLE = "Active Users";const DEFAULT_DESCRIPTION = "Real-time Activity";const DEFAULT_CURRENT_VALUE = "2,150";const DEFAULT_VALUE_DESCRIPTION = "Users online now";export const ActiveUsersCard: React.FC<ActiveUsersCardProps> = ({  className = "",  title = DEFAULT_TITLE,  description = DEFAULT_DESCRIPTION,  currentValue = DEFAULT_CURRENT_VALUE,  valueDescription = DEFAULT_VALUE_DESCRIPTION,  timeData = DEFAULT_TIME_DATA,}) => {  const isInteractive = true;  const index = 23;  const maxUsers = Math.max(...timeData.map((d) => d.users));  return (    <motion.div      layoutId={isInteractive ? `card-${index}-${title}` : undefined}      transition={{ duration: 0.4, ease: "easeOut" }}      className={cn(        "relative overflow-hidden rounded-xl border border-border bg-card text-card-foreground p-6 shadow-sm transition-all flex flex-col group",        isInteractive          ? "cursor-pointer hover:border-zinc-300 dark:hover:border-zinc-700"          : "",        className,      )}    >      <div className="mb-4 flex items-start justify-between relative z-10">        <div>          <h3 className="font-semibold text-lg tracking-tight text-foreground">            {title}          </h3>          {description && (            <p className="text-sm text-muted-foreground mt-1">{description}</p>          )}        </div>        <div className="rounded-full bg-zinc-100 dark:bg-zinc-800 p-2 text-foreground flex items-center justify-center">          <Users className="h-5 w-5 text-purple-500" />        </div>      </div>      <div className="relative z-10 flex-1">        <div className="flex items-baseline gap-2 mb-1">          <div className="text-3xl font-bold text-foreground">            {currentValue}          </div>          <Activity className="h-5 w-5 text-emerald-500 animate-pulse" />        </div>        <p className="text-sm text-muted-foreground mb-4">{valueDescription}</p>        <div className="flex items-end justify-between h-32 gap-2">          {timeData.map((item, idx) => {            const height = (item.users / maxUsers) * 100;            return (              <div                key={idx}                className="flex-1 flex flex-col items-center gap-2"              >                <motion.div                  initial={{ height: 0 }}                  animate={{ height: `${height}%` }}                  transition={{ duration: 0.8, delay: idx * 0.1 }}                  className="w-full bg-gradient-to-t from-purple-500 to-purple-400 rounded-t-lg relative"                >                  <div className="absolute -top-6 left-1/2 -translate-x-1/2 text-xs font-medium text-foreground">                    {(item.users / 1000).toFixed(1)}K                  </div>                </motion.div>                <span className="text-xs text-muted-foreground">                  {item.time}                </span>              </div>            );          })}        </div>      </div>    </motion.div>  );};

Usage

This component is a data-rich dashboard card displaying e-commerce metrics with animated visualizations and dark mode support. Perfect for dashboards, landing pages, and analytics interfaces.

Prop

Type

On this page

Free block

Need this in production?

Unlock install commands, source access, commercial use, and AI prompts for all VectorMotion blocks.