Skip to content
caliper ui docs

Pro

Direction sphere

A direction input shaped like what it controls. Drag a light across a sphere and a sample beside it takes the highlight and drop shadow of that light. Two sliders carry the same two numbers, so the sphere is a convenience and never the only way in.

Pro
pnpm dlx shadcn@latest add @caliper/direction-sphere

Raised card shadow

Where the light falls on cards in the Halden theme

315° azimuth 48° elevation

Raised
Installs components/ui/direction-sphere.tsxDepends on @radix-ui/react-slot, lucide-reactMotion none in component source

When to use

Use it for

  • Light and shadow direction in a design tool, an emboss or a drop-shadow editor.
  • Any value that is two angles, such as azimuth and elevation.

Skip it when

  • A single angle; use a dial or a slider.
  • Exact placement of a point on a plane; use two number fields.

Decisions

Why it is built this way, so you know what to keep when you change your copy.

Behaviour

The sliders are the accessible input
Azimuth runs 0 to 359 and elevation 5 to 90, each a native range with value text. The sphere takes the arrow keys as well, 5 degrees a press and 15 with Shift.
The numbers are always written
The readout names both angles in degrees, so the picture never carries the value alone.

Styling

The sphere is shaded by the light it sets
The middle is light from straight on and the rim is light from the side. Dragging has no easing, so reduced motion changes nothing.

Installation

terminal
pnpm dlx shadcn@latest add @caliper/direction-sphere

Adds its 6 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.

example.tsx
import { DirectionSphere } from "@/components/ui/direction-sphere"

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
Checking your licence…

API reference

DirectionSphere

component
PropTypeDefaultDescription
labelstring"Light direction"
azimuthnumber—Controlled when set.
defaultAzimuthnumber315
elevationnumber—Controlled when set.
defaultElevationnumber48
onChange((value: LightDirection) => void)—
previewReactNode—Replaces the sample button. It sits on a stage that provides the light as custom properties.
statusDepthStatus"ready"
messagesDepthMessages—
onRetry(() => void)—
disabledboolean—
classNamestring—

Accessibility

It exposes group semantics, with aria-roledescription, aria-label, aria-live and aria-valuetext kept in step with state. Changes that matter are announced through a live region.

KeyBehaviour
←Moves to the previous item or value.
→Moves to the next item or value.
↑Moves to the previous item or value.
↓Moves to the next item or value.

Motion

It declares no animation in its component source. Any transition comes from its stylesheet, which uses the duration tokens that collapse to instant under prefers-reduced-motion.

All Surfaces examples