Components
Use the RadialClockFace component to render a radial, ring-style clock face (12h or 24h) with ticks and labels.
Customize via CSS variables or Tailwind utilities around the component.
Set variables per theme in your global CSS.
/* app/globals.css */
:root {
--clock-ring-inner: #0a0a0a;
--clock-tick-major: rgba(0,0,0,0.85);
--clock-tick-medium: rgba(0,0,0,0.5);
--clock-tick-minor: rgba(0,0,0,0.25);
--clock-tick-hairline: rgba(0,0,0,0.08);
--clock-label: rgba(0,0,0,0.9);
}
.dark {
--clock-tick-major: rgba(255,255,255,0.85);
--clock-tick-medium: rgba(255,255,255,0.5);
--clock-tick-minor: rgba(255,255,255,0.25);
--clock-tick-hairline: rgba(255,255,255,0.08);
--clock-label: rgba(255,255,255,0.9);
}Create a brand class that adjusts the ticks/labels for colored backgrounds.
.brand-indigo {
--clock-tick-major: rgba(255,255,255,0.92);
--clock-tick-medium: rgba(255,255,255,0.6);
--clock-tick-minor: rgba(255,255,255,0.35);
--clock-tick-hairline: rgba(255,255,255,0.12);
--clock-label: rgba(255,255,255,0.95);
}Import the component and render it.
import { RadialClockFace } from "@/components/ui/radial-clock-face"export default function Example() {
return (
<div className="p-6 grid place-items-center">
<RadialClockFace
size={480}
mode="12h"
period="AM"
labelStep={3}
/>
</div>
)
}All props are optional unless noted.
| Prop | Type | Default | Description |
|---|---|---|---|
| size | number | 600 | Overall square size in px. |
| mode | "12h" | "24h" | "24h" | Clock mode. |
| period | "AM" | "PM" | — | For 12h mode, which period to render styling for. |
| labelStep | number | 3 | Show hour labels every N hours. |
| className | string | — | Additional classNames on the root svg element. |