Function

useTimelinePlayheadControl

Adapts the timeline playhead to a Base UI-compatible scalar slider. Use this hook when an application wants its own playhead scrubber, time field, or transport control while preserving the shared `TimelineEngine` state. It composes with `useTimelinePlayback`, which exposes imperative transport commands without subscribing to live playhead ticks.

Signature

Type Definition
useTimelinePlayheadControl(options: TimelinePlayheadControlOptions = {}): object

Parameters

NameTypeDescription
optionsTimelinePlayheadControlOptionsOptional bounds, step size, label, and commit callback for the playhead control.

Returns

object

Current playhead seconds, formatted value text, imperative setters, and props for `Slider.Root` plus `Slider.Thumb`.

Return members

NameSignatureDescription
commit(nextValue: number = control.value): voidMoves the playhead and settles the engine interaction.
getAriaValueText(value: number): stringFormats a timeline second value for `aria-valuetext`.
labellabel: stringAccessible label used by the default thumb props.
maxmax: numberMaximum playhead time in seconds.
minmin: numberMinimum playhead time in seconds.
rootPropsrootProps: objectProps for a Base UI `Slider.Root`.
setValue(nextValue: number): voidMoves the playhead to an absolute time in seconds without settling history.
stepstep: numberSlider step in seconds.
stepBy(deltaSeconds: number): voidMoves the playhead by a relative number of seconds.
thumbPropsthumbProps: { aria-label: string; aria-valuetext: string }Props for a Base UI `Slider.Thumb`.
valuevalue: numberCurrent playhead time in seconds.
valueTextvalueText: stringFormatted playhead value for assistive technology.

Examples

tsx Example
const playhead = useTimelinePlayheadControl();
return (
<Slider.Root {...playhead.rootProps}>
<Slider.Control>
<Slider.Track>
<Slider.Indicator />
<Slider.Thumb {...playhead.thumbProps} />
</Slider.Track>
</Slider.Control>
</Slider.Root>
);