Kavolis

Components

Radial Clock Face

Use the RadialClockFace component to render a radial, ring-style clock face (12h or 24h) with ticks and labels.

3
Custom

Installation

  1. Create components/ui/radial-clock-face.tsx with the code below.
  2. Use the import line to reference it in your app.
TScomponents/ui/radial-clock-face.tsx

Customization

Customize via CSS variables or Tailwind utilities around the component.

Light/Dark Themes

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);
}

Brand Variant

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);
}

Usage

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>
  )
}

Examples

Outline

12h with labels every 2 hours

Dense labels (every hour)

Rolex Pepsi bezel (horizontal)

API Reference

All props are optional unless noted.

PropTypeDefaultDescription
sizenumber600Overall square size in px.
mode"12h" | "24h""24h"Clock mode.
period"AM" | "PM"For 12h mode, which period to render styling for.
labelStepnumber3Show hour labels every N hours.
classNamestringAdditional classNames on the root svg element.