OpenSourceUIOpenSourceUIOpensource UI
GitHub—
  1. Home
  2. Components
  3. Widgets
  4. Step Count
Back to WidgetsComponents / Widgets

Step Count

Free Widgets 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. 1

    Run in your terminal:

    $npm install clsx tailwind-merge lucide-react
  2. 2

    Copy lib/cn.ts below. Skip if you already have cn().

  3. 3

    Copy the code below and create components/widgets/step-count-widget.tsx in your project.

  4. 4

    Import and render:

    Example

    import { StepCountWidget } from "@/components/widgets/step-count-widget";

    <StepCountWidget steps={8432} goal={10000} label="steps today" />

lib/cn.ts

1
2
3
4
5
6
import { type ClassValue, clsx } from "clsx";
import { twMerge } from "tailwind-merge";
 
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}

components/widgets/step-count-widget.tsx

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
"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 (
<div
ref={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";
PreviousNext

On this

page

Jump to a section on this page.

  • lib/cn.ts
  • components/widgets/step-count-widget.tsx