Focus

Pan and zoom the timeline to a specific item, date, or range.

If the user has enabled prefers-reduced-motion in their OS settings, animations are automatically skipped — the timeline jumps to the target position instantly.

FocusOptions

PropertyTypeDefaultDescription
idstring | numberItem identifier to focus on.
datestring | number | DateDate to centre the timeline on.
range[DateInput, DateInput]Two-element tuple defining the range to display.
animatebooleanfalseAnimate the transition.
durationnumber500Animation duration in milliseconds.
easingEasingFunction"easeInOut"Easing curve for the animation.
zoomboolean | "auto""auto"Whether to zoom to fit the target item. "auto" zooms only when the item is large relative to the current view.

Calling focus() with no arguments centres the timeline on the full range of all items.

Note: calling focus() clears any active tooltip.

When zoom is set to "auto", the timeline only zooms if the target item occupies more than 80% of the current visible range. Otherwise it keeps the current zoom level and centres on the item.

Focus by Item

timeline.focus({ id: 42, animate: true, duration: 800 });

Focus by Date

timeline.focus({ date: '2026-06-15', animate: true });

Focus by Range

timeline.focus({
  range: ['2026-01-01', '2026-03-31'],
  animate: true,
  duration: 600
});

Easing Functions

The easing option accepts one of the following values:

ValueDescription
"linear"Constant speed, no acceleration.
"easeIn"Starts slow, accelerates.
"easeOut"Starts fast, decelerates.
"easeInOut"Slow start and end, fast middle. This is the default.
"easeInCubic"Stronger ease-in curve.
"easeOutCubic"Stronger ease-out curve.
"easeInOutCubic"Stronger ease-in-out curve.