Pro
Sun path
A day's sun drawn on its arc, with a slider to move through the day. The sky changes colour with the sun's height, and after sunset a moon takes the same arc as stars come out.
pnpm dlx shadcn@latest add @caliper/sun-pathWhen to use
Use it for
- Weather, travel, photography and solar-energy pages.
- Anywhere the time of day shapes a decision.
Skip it when
- Exact positions in the sky; it is an illustration of the day's shape.
- Polar days and nights with no sunrise.
Decisions
Why it is built this way, so you know what to keep when you change your copy.
Behaviour
- Jumps glide
- Dawn, Noon, Dusk and Midnight move the sun there over about a second; dragging the slider is direct.
Styling
- Blended in OKLab
- The sky is mixed between night, twilight and day in a perceptual colour space, so the middle is never muddy.
Usage
- Times as text
- Sunrise, sunset and daylight length are written out, and the slider reads its time aloud.
Installation
pnpm dlx shadcn@latest add @caliper/sun-path
Adds its 3 files to components/ui/, each with its own stylesheet, and installs their packages. Pro installs with your access token, set up once per project. See Pro access. The first part also adds Caliper UI’s tokens; import them once as in Installation.
Usage
Import it from your copy of the source. The example behind the preview comes with the source. It is built from SunPath, bodyAt, toMinutes and formatClock.
import { SunPath, bodyAt, toMinutes, formatClock } from "@/components/ui/sun-path"
The worked example comes with Pro
The 23-line example behind the preview opens here, ready to copy.
- 626 Pro parts, blocks and page templates, all with source
- $149 once, with lifetime updates. No renewal
- A full refund within 14 days if it is not for you
API reference
SunPath
component
Also accepts the native props of its root element and a ref.
bodyAt
component
No props of its own; it accepts the native props of its root element.
toMinutes
component
No props of its own; it accepts the native props of its root element.
formatClock
component
No props of its own; it accepts the native props of its root element.
Accessibility
It exposes group semantics, with aria-hidden, aria-label and aria-valuetext kept in step with state.
No custom key handling; Tab and the native activation keys do the work.
Motion
It checks prefers-reduced-motion itself and settles immediately instead of travelling. Every state is still reachable.
Related
- Weather sceneThe sky behind a forecast, drawn in the ink of the theme: a slow sun with turning rays, clouds that drift in layers, rain in two depths, snow that sways, and a storm's rain with an occasional soft flash of lightning. A change of condition blends across.
- Time dialA circular control for choosing a time.
- Clock wallA wall of small analog clocks whose hands line up to draw digits. When the value changes every hand sweeps into a slanting wave across the wall, then turns on into the new figure, always clockwise, rippling from left to right.