Skip to main content

TimeRangeControl

Presets plus the resolved absolute dates — what makes a dashboard reproducible.

Signature
Density
Viewport
Theme and light/dark are set in the top bar
Live demo
Open ↗

When to use​

Presets plus the resolved absolute dates — what makes a dashboard reproducible.

Accessibility​

Fully keyboard operable: Tab to focus, Enter/Space to activate. The visible focus ring uses --focus-ring — never remove it. Provide an accessible label (aria-label) for icon-only controls.

Install and import​

npx shadcn@latest add @prism/time-range-control
import { TimeRangeControl } from '@/components/prism/TimeRangeControl';

In a no-build prototype, read it from the bundle instead: const { TimeRangeControl } = window.PrismDesignSystem_39d121;

Props​

PropTypeRequiredDescription
value"7d" | "30d" | "90d" | "12m"—
onChange(range: ResolvedRange) => void—Reports the RESOLVED dates, not just the preset id — store both with saved views.
comparisonboolean—
onComparisonChange(on: boolean) => void—
now() => Date—Injectable clock, for tests and for stories that must not drift.
classNamestring—