terra vidhal

Habit Tracker

Component 2

About

A weekly habit tracker with a checkable seven-day grid, per-habit target bars, animated check marks, a highlighted today column, arrow-key navigation between cells and a clear-week action with a timed undo. Summary statistics count total check-ins, habits that reached their target and the overall week completion.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Habit Tracker to your project and fits it to your theme.

Code

How Habit Tracker is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client";

/**
 * PrequelUI Animate — MIT — https://prequeluianimate.terravidhal.me
 */

import { HabitTracker, type Habit } from "@/components/ui/habit-tracker";

const HABITS: Habit[] = [
  { id: "walk", name: "Morning walk", accent: "sky", target: 7 },
  { id: "read", name: "Read 20 pages", accent: "violet", target: 5 },
  { id: "stretch", name: "Stretch for ten minutes", accent: "amber", target: 6 },
  { id: "screens", name: "No screens after ten", accent: "emerald", target: 5 },
  { id: "plan", name: "Plan tomorrow", accent: "rose", target: 4 },
];

const ENTRIES: Record<string, boolean[]> = {
  walk: [true, true, true, false, true, true, false],
  read: [true, false, true, true, false, true, true],
  stretch: [false, true, true, true, true, false, false],
  screens: [true, true, false, true, true, true, true],
  plan: [false, false, true, true, false, true, false],
};

export default function HabitTrackerDemo() {
  return (
    <main className="flex min-h-screen w-full items-center justify-center bg-background px-4 py-12 sm:px-6">
      <HabitTracker
        habits={HABITS}
        initialEntries={ENTRIES}
        weekLabel="Nov 24 – Nov 30"
        todayIndex={6}
        title="Weekly habits"
        description="Five small routines, tracked one day at a time."
      />
    </main>
  );
}

Dependencies

More by terra vidhal

View all
  • Gravity Stars Background

    Gravity Stars Background

    16
  • Audio Waveform

    Audio Waveform

    13
  • Topographic Lines

    Topographic Lines

    12
  • Notification Center

    Notification Center

    11
  • Booking Calendar

    Booking Calendar

    11
  • Spotlight Card

    Spotlight Card

    11
  • Command Palette

    Command Palette

    9
  • Kpi Counter

    Kpi Counter

    9

Explore more

Part of PrequelUI Animate — browse the full library on 21st.dev.