shadimage
8starlabs-ui
exampleflip-clock-showdays-demosource: ok · hit

Flip clock

A flip clock demo component

npx shadcn add "https://ui.8starlabs.com/r/flip-clock-showdays-demo.json"
free

No selection tags yet — empty means no evidence, not lack of support.

Files1 · source cached 10/9/2026, 10:16:58 PM

registry/8starlabs-ui/examples/flip-clock-showdays-demo.tsx
"use client";

import { useEffect, useState } from "react";
import FlipClock from "@/registry/8starlabs-ui/blocks/flip-clock";

const DAY = 1000 * 60 * 60 * 24;

export default function FlipClockShowDaysDemo() {
  const [targets, setTargets] = useState<{
    oneDay: Date;
    fiveHundredDays: Date;
  }>();

  useEffect(() => {
    const now = Date.now();

    setTargets({
      oneDay: new Date(now + DAY),
      fiveHundredDays: new Date(now + DAY * 500)
    });
  }, []);

  return (
    <div className="flex flex-col gap-8">
      {/* Always show days, even if zero */}
      <FlipClock
        countdown={true}
        showDays="always"
        targetDate={targets?.oneDay}
        size={"md"}
      />
      {/* Show days only if non-zero */}
      <FlipClock
        countdown={true}
        showDays="auto"
        targetDate={targets?.oneDay}
        size={"md"}
      />
      {/* Never show days, even if 1 or more */}
      <FlipClock
        countdown={true}
        showDays="never"
        targetDate={targets?.fiveHundredDays}
        size={"md"}
      />
    </div>
  );
}

More from 8starlabs-ui

Browse all components in this library →