Back to Activity
Components / Activity
Step Count
Free Activity React component — StepCountWidget. MIT licensed, copy-paste ready for Next.js and Tailwind CSS.
Editorial step stat — light wide card, large number, goal in a quiet footer row. No progress bars or icons.
Preview
Today
8,432
steps today
Goal 10,00084%
Setup
How to use
Free for personal and commercial use. No UI attribution required. Include the MIT copyright notice when copying component source into your project. Read the MIT license.
- 1
Run in your terminal:
$npm install clsx tailwind-merge lucide-react - 2
Copy
lib/cn.tsbelow. Skip if you already havecn(). - 3
Copy the code below and create
components/activity/step-count-widget.tsxin your project. - 4
Import and render:
Exampleimport { StepCountWidget } from "@/components/activity/step-count-widget";
lib/cn.ts
import { type ClassValue, clsx } from "clsx";import { twMerge } from "tailwind-merge";export function cn(...inputs: ClassValue[]) {return twMerge(clsx(inputs));}
components/activity/step-count-widget.tsx
"use client";import { forwardRef, type ComponentPropsWithoutRef } from "react";import { cn } from "@/lib/cn";export type StepCountWidgetProps = Readonly<{steps?: number;goal?: number;label?: string;} & ComponentPropsWithoutRef<"div">>;// Daily steps — editorial stat card, typography-led.export const StepCountWidget = forwardRef<HTMLDivElement, StepCountWidgetProps>(({className,steps = 8432,goal = 10_000,label = "steps today",...props},ref,) => {const progress = Math.min(100, Math.round((steps / goal) * 100));return (<divref={ref}data-slot="step-count-widget"className={cn("w-64 rounded-3xl border border-neutral-200/80 bg-white p-6 font-sans shadow-lg shadow-black/5 select-none",className,)}{...props}><p className="text-[11px] text-neutral-400">Today</p><p className="mt-4 text-5xl leading-none font-light tracking-tight text-neutral-900 tabular-nums">{steps.toLocaleString()}</p><p className="mt-2 text-sm text-neutral-500">{label}</p><div className="mt-8 flex items-center justify-between border-t border-neutral-100 pt-4"><span className="text-xs text-neutral-400">Goal {goal.toLocaleString()}</span><span className="text-xs font-medium text-neutral-700 tabular-nums">{progress}%</span></div></div>);},);StepCountWidget.displayName = "StepCountWidget";