Function

useTimelineTrack

Accesses one timeline track with canvas-aligned row geometry and commands.

Usage notes

Use this hook when a component owns controls for one specific row: mute, visibility, lock, targeted state, grouping, or row height. It returns safe no-op failure commands when the track id is missing, so header components can remain mounted while project data changes.

Signature

Type Definition
useTimelineTrack(trackId: string, options: TimelineTrackGeometryOptions = {}): UseTimelineTrackResult<TrackKind>

Type parameters

NameConstraintDefaultDescription
TrackKindstringstringApp-defined track kind value carried by the requested track.

Parameters

NameTypeDescription
trackIdstringTrack id to read and update.
optionsTimelineTrackGeometryOptionsOptional track geometry overrides matching the renderer.

Returns

Track row state, canvas-aligned geometry, and row-scoped commands.

Examples

tsx Example
import { useTimelineTrack } from '#react/hooks';
export function TrackMuteButton({ trackId }: { trackId: string }) {
const track = useTimelineTrack(trackId);
return (
<button type="button" aria-pressed={track.muted} onClick={() => track.toggleMute()}>
{track.muted ? 'Unmute' : 'Mute'} {track.name ?? track.trackId}
</button>
);
}