Skip to content
omaris

Data Display

Clock

An analog clock face — the home-screen widget, for a dashboard.

import { Clock } from 'omaris'
Learn

Examples

Basic

A live clock — no props. It keeps the time now, steps the second hand on a small spring, and reads out as "10:42 AM" to a screen reader.

<script lang="ts">	import { Clock } from 'omaris';</script>​<Clock />

Styles

shape is any outline from the shape library, hands and markers pick the dial, and variant × tone colour it the way they colour a button.

123456789101112
12369
<script lang="ts">	import { Clock } from 'omaris';</script>​<div class="flex flex-wrap items-start gap-6">	<Clock value="10:09:36" size="8rem" />	<Clock value="10:09:36" size="8rem" shape="circle" hands="classic" markers="full" />	<Clock		value="10:09:36"		size="8rem"		shape="square"		hands="minimal"		markers="dots"		variant="filled"		tone="primary"	/>	<Clock value="10:09:36" size="8rem" shape="clover-8" markers="quarters" tone="tertiary" />	<Clock value="10:09:36" size="8rem" shape="cookie-9" variant="outline" markers="ticks" /></div>

World clocks

timeZone makes a world clock, and label with showTime captions it — the strip across the top of an operations dashboard. Each one keeps its own zone's time, always 12-hour.

<script lang="ts">	import { Card, Clock } from 'omaris';​	const offices = [		{ city: 'Baghdad', zone: 'Asia/Baghdad', tone: 'primary' },		{ city: 'London', zone: 'Europe/London', tone: 'secondary' },		{ city: 'New York', zone: 'America/New_York', tone: 'tertiary' },		{ city: 'Tokyo', zone: 'Asia/Tokyo', tone: 'info' }	] as const;</script>​<Card class="grid w-full grid-cols-2 gap-4 p-4 sm:grid-cols-4">	{#each offices as office (office.city)}		<Clock			class="mx-auto"			timeZone={office.zone}			tone={office.tone}			label={office.city}			showTime			size="6.5rem"		/>	{/each}</Card>

Overridden

classes reaches every part — the face, each hand, the pin, the caption — and the face shrinks to a narrow container rather than overflowing it.

<script lang="ts">	import { Clock } from 'omaris';</script>​<div class="w-32">	<Clock		value="18:45"		size="12rem"		seconds={false}		label="Close of business"		showTime		class="w-full"		classes={{			face: 'fill-tertiary-container',			hour: 'stroke-tertiary',			minute: 'stroke-primary',			label: 'text-label-lg'		}}	/></div>

When to use it

Use it for

  • A clock on a dashboard: the time where the team is, a world-clock strip of offices, the hour a shift ends. It is live by default and keeps itself.
  • A fixed time drawn as a face — an appointment card, "closes at 6:45 PM" — with value. A change glides the hands rather than jumping.
  • A face that matches the rest of an MD3 screen: any outline from the shape library, three hand styles, six sets of markers, and the variant × tone pair a button takes.

Not for

  • Picking a time → Clock Picker, or a Time Field in a form.
  • A time in a table, a feed or a sentence → Text with the time formatted through latn(); a face is too much ink for a row.
  • Time left, or time since → Progress or a Gauge for a countdown, relativeTime from Runes for "3 minutes ago".

Do

  • Give each world clock a label and timeZone, and turn on showTime when the exact minute matters — an analog face is read at a glance, not to the minute.
  • Pick the shape for the screen, not the clock: circle in a dense grid, cookie-12 or clover-8 where the face is the decoration.
  • Use seconds={false} when several clocks share a screen; a row of second hands is a row of things moving.
  • Use markers="numbers" or "full" with hands="classic", and the bare face with hands="bold" — the widget look.

Don't

  • Rely on it for a deadline or a timestamp someone must read exactly. Put the digits beside it.
  • Pass a 24-hour string to show. "18:45" is data; the face and showTime always read 6:45 PM.
  • Recolour the hands with raw colours — classes={{ hour: 'stroke-primary' }} keeps them on the palette in light and dark.

Quick reference

variant
  • tonal (default)
  • filled
  • outline

How the colour is applied — a tinted face, a solid one, or a hairline.

tone
  • primary
  • secondary (default)
  • tertiary
  • success
  • warning
  • destructive
  • info
hands
  • bold (default)
  • classic
  • minimal

The hands. bold is the widget in the screenshot — two thick rounded bars, the minute one lighter. classic is a wall clock. minimal is two hairlines and a dot that orbits for the seconds.

motion
  • tick (default)
  • sweep

The second hand steps on a spring, or glides.

API

Clock

An analog clock face — the home-screen widget, for a dashboard.

The face is any outline from the Material 3 shape library: a scalloped cookie-12 by default, or a circle, a square, a clover, a burst. On it go three hands in one of three styles and one of six sets of markers, coloured by the same variant × tone pair a button takes — so a world clock in a tinted card, a dark one in a hero and an outlined one in a table row are props, not CSS.

Live by default. With no value it shows the time now and keeps it, the second hand stepping with a small spring (motion="tick") or gliding (motion="sweep"); timeZone turns it into a world clock. Hands always travel the short way round, so 11:59 to 12:00 is a step forward, not a spin backwards. Pass value — a Date or a stored "14:30" — and it holds still at that time, gliding when it changes.

Reduced motion stops the spring and the sweep: hands jump, once a second. A screen reader hears the time once — "10:42 AM, Baghdad" — as the image's name, not a ticking region.

import { Clock } from 'omaris'
<Clock /><Clock timeZone="Asia/Tokyo" label="Tokyo" showTime tone="tertiary" /><Clock value="09:30" shape="circle" markers="numbers" hands="classic" seconds={false} />

Parts

Every element this renders is reachable from outside. Pass Tailwind for one part as classes={{ part: '…' }}; class covers the root and is merged last, so it always wins.

root
The face and its caption, stacked. --clock-size sizes the face.
svg
The square SVG everything is drawn in.
face
The shaped dial.
marker
Dots and ticks round the edge.
numeral
The 1–12 (or 12-3-6-9) numerals.
hour
The hour hand.
minute
The minute hand.
second
The second hand — a line, or an orbiting dot with hands="minimal".
pin
The cap over the middle, where the hands meet.
caption
The text under the face.
label
The label line — a city, a team, a room.
time
The digital time, with showTime.

Props

value

Defaults to null

Date | string | null

A fixed time — a Date, or a stored "14:30" / "14:30:15". Leave it out for a live clock that keeps the time now.

timeZone
string

An IANA zone — "Asia/Baghdad" — for a world clock. Defaults to the device's.

shape

Defaults to 'cookie-12'

ShapeName

The outline of the face, from the shape library.

variant

Defaults to 'tonal'

ClockVariant

tonal (a tinted face), filled (a solid one) or outline (a hairline).

tonal
filled
outline
tone

Defaults to 'secondary'

ClockTone

The colour role. secondary is neutral grey.

primary
secondary
tertiary
success
warning
destructive
info
hands

Defaults to 'bold'

ClockHands

bold, classic or minimal.

bold
classic
minimal
markers

Defaults to 'none'

ClockMarkers

none, dots, ticks, numbers, quarters or full.

seconds

Defaults to true

boolean

Draw the second hand.

motion

Defaults to 'tick'

ClockMotion

tick steps once a second with a spring; sweep glides. Reduced motion always ticks.

tick
sweep
size

Defaults to '10rem'

string | number

Width and height of the face, as a CSS length. Numbers are pixels.

label
string

A line under the face — a city, a team, a room. Also read in the accessible name.

showTime

Defaults to false

boolean

The time in digits under the face — 10:42 AM, always 12-hour.

locale
string

BCP-47 tag for the numerals and the digital time. Defaults to <html lang>.

class
string

Merged onto the root.

classes
ClockClasses

Per-part Tailwind overrides. class still covers the root.