Widgets

Clock

An analog or digital clock for any time zone, for world clocks and dashboards.

Installation

npx sinaui add clock

Examples

World clocks

Each says how far ahead or behind your own time it is; faces dim after dark. All clocks on a page tick together.

Baghdad
Cairo
Córdoba
Samarkand
<script lang="ts">
	import Clock from '#lib/ui/Clock.svelte';
	import Widget from '#lib/ui/Widget.svelte';

	const cities = [
		{ label: 'Baghdad', timeZone: 'Asia/Baghdad' },
		{ label: 'Cairo', timeZone: 'Africa/Cairo' },
		{ label: 'Córdoba', timeZone: 'Europe/Madrid' },
		{ label: 'Samarkand', timeZone: 'Asia/Samarkand' }
	];
</script>

<Widget label="World clock">
	<div class="row">
		{#each cities as c (c.label)}
			<Clock {...c} size={96} />
		{/each}
	</div>
</Widget>

<style>
	.row {
		display: flex;
		flex-wrap: wrap;
		justify-content: center;
		gap: 1.5rem;
	}
</style>

Digital

Your time
<script lang="ts">
	import Clock from '#lib/ui/Clock.svelte';
</script>

<Clock variant="digital" label="Your time" />

LED

Seven-segment digits on a dark panel. Segments fade as they change, the colon blinks each second.

Your time
<script lang="ts">
	import Clock from '#lib/ui/Clock.svelte';
</script>

<Clock variant="led" label="Your time" />

LED, your own color

Any color for the segments; here without seconds, in another time zone.

Baghdad
<script lang="ts">
	import Clock from '#lib/ui/Clock.svelte';
</script>

<Clock variant="led" timeZone="Asia/Baghdad" label="Baghdad" seconds={false} color="#ff4d3d" />

Props

PropTypeDefault
timeZonestring: IANA, like 'Asia/Baghdad'the reader’s
labelstring: a place name
variant'analog' | 'digital' | 'led''analog'
colorstring: lit color, LED only'#3ee6a2'
secondsbooleantrue
sizenumber: analog diameter in px144
localestring'en'

For your own live times, now() from now.svelte.ts returns the current time and updates every second wherever it's read.

Accessibility

  • Read as the place and the time to the minute (“Baghdad, 4:05 PM”), never ticking aloud every second.
  • Nothing is shown until the time is known in the browser, so it never flashes a wrong time.
  • With reduced motion, the second hand moves without its tick.
Introduction
Theming
Changelog
Button
Action button
Confirm button
Copy button
Hold to confirm
Split button
Calendar
Checkbox
Color picker
Combobox
Date picker
Date range picker
File drop
Form
Input
Mention input
Multi select
Number field
OTP input
Password input
Phone input
Radio cards
Radio group
Rich text editor
Search field
Segmented control
Select
Signature pad
Slider
Switch
Tag input
Upload
Wheel picker
Textarea
Time field
Toggle group
Toolbar
Alert dialog
Command palette
Context menu
Dialog
Drawer
Dropdown
Hover card
Popover
Tooltip
Announcement bar
Alert
Empty state
Meter
Progress
Rolling number
Skeleton
Spinner
Toast
Avatar
Avatar group
Badge
Card
Carousel
Chart
Chat
Code block
Data table
Folder
Kbd
Mind map
Resizable panels
Scroll area
Separator
Sortable
Table
Tag group
Virtual list
Audio player
Image
Image compare
Video
Visualizer
Breadcrumb
File tree
Menubar
Navigation menu
Pagination
Sidebar layout
Stepper
Tabs
Alarm clock
Clock
Dynamic island
Fluid orb
Hourglass
Stopwatch
Timer
AI chat
AI media
Auth
Board
Booking
Dashboard
File explorer
Messaging
Notifications
Settings
Team
Overview
Pricing
Agent chat
Calendar
Voice agent
Mail inbox
CMS
Blog
Marketing site
E-commerce
AI agents
SaaS landing page
SaaS app
Accordion
Dark theme
Light theme