Local Clock
atroui/local-clockFreeBlock
Timezone-aware local time chip.
Install it
npx shadcn@latest add https://atroui.com/r/local-clock.jsonSource
1"use client"23import * as React from "react"45import { cn } from "@/lib/utils"67/** Defaults — edit timezone props after install. */8const CONTENT = {9 timezone: "America/New_York",10 timezoneLabel: "ET",11}1213export function LocalClock({14 timezone = CONTENT.timezone,15 timezoneLabel = CONTENT.timezoneLabel,16 className,17}: {18 timezone?: string19 timezoneLabel?: string20 className?: string21} = {}) {22 const [now, setNow] = React.useState<Date | null>(null)2324 React.useEffect(() => {25 const tick = () => setNow(new Date())26 tick()27 const timer = window.setInterval(tick, 30_000)28 return () => window.clearInterval(timer)29 }, [])3031 const time = now32 ? new Intl.DateTimeFormat("en-US", {33 timeZone: timezone,34 hour: "numeric",35 minute: "2-digit",36 hour12: true,37 }).format(now)38 : "—:—"3940 return (41 <span42 className={cn(43 "inline-flex items-center gap-1 font-mono text-[11.5px] text-muted-foreground tabular-nums",44 className45 )}46 aria-label={`Local time in ${timezoneLabel}: ${time}`}47 title={`${timezoneLabel} · ${timezone}`}48 >49 <span className="text-foreground">{time}</span>50 <span className="text-muted-foreground/70">{timezoneLabel}</span>51 </span>52 )53}
What it pulls in
Other registry items
Files it writes
More from atroui
All 81 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Analytics Provideranalytics-provider | atroui | Blocks | Free | 1 dep | |
| AR Portfolioar-portfolio | atroui | Blocks | Free | 1 dep | |
| Before / Afterbefore-after-slider | atroui | Blocks | Free | no deps | |
| Calendly Embedcalendly-embed | atroui | Blocks | Free | 1 dep | |
| Changelogchangelog | atroui | Blocks | Free | no deps | |
| Command Menucommand-menu | atroui | Blocks | Free | 4 deps | |
| Contact Formcontact-form | atroui | Blocks | Free | 2 deps | |
| Contextual CTAcontextual-cta | atroui | Blocks | Free | 2 deps |
