RVE LogoReact Video EditorDOCS
RVE Pro/Components/Timeline/Props

Props

Complete reference for all Timeline component props and their usage

The Timeline component accepts the following props to customize its behavior and appearance:

Data Props

PropTypeDefault ValueDescription
tracksTimelineTrack[]requiredArray of timeline tracks containing items to display
totalDurationnumberrequiredTotal duration of the timeline in seconds
currentFramenumberundefinedCurrent playhead position frame number
fpsnumber30Frames per second for timeline calculations

Event Handler Props

PropTypeDefault ValueDescription
onFrameChange(frame: number) => voidundefinedCallback when playhead position changes
onItemMove(itemId: string, newStart: number, newEnd: number, newTrackId: string) => voidundefinedCallback when an item is moved to a new position or track
onItemResize(itemId: string, newStart: number, newEnd: number) => voidundefinedCallback when an item is resized
onItemSelect(itemId: string) => voidundefinedCallback when an item is selected
onDeleteItems(itemIds: string[]) => voidundefinedCallback when items are deleted
onDuplicateItems(itemIds: string[]) => voidundefinedCallback when items are duplicated
onSplitItems(itemId: string, splitTime: number) => voidundefinedCallback when an item is split at a specific time
onTracksChange(tracks: TimelineTrack[]) => voidundefinedCallback when tracks are modified
onAddNewItem(item: Partial<TimelineItem> & { trackId: string; start: number; end: number }) => voidundefinedCallback when a new item is added

Selection Props

PropTypeDefault ValueDescription
selectedItemIdsstring[]undefinedArray of currently selected item IDs
onSelectedItemsChange(itemIds: string[]) => voidundefinedCallback when selection changes

UI Control Props

PropTypeDefault ValueDescription
showZoomControlsbooleanfalseWhether to show zoom in/out controls
showPlaybackControlsbooleanfalseWhether to show play/pause controls
showTimelineGuidelinesbooleantrueWhether to show alignment guidelines during drag
showUndoRedoControlsbooleanfalseWhether to show undo/redo buttons
showAspectRatioControlsbooleanfalseWhether to show aspect ratio controls

Playback Props

PropTypeDefault ValueDescription
isPlayingbooleanundefinedCurrent playback state
onPlay() => voidundefinedCallback when play is triggered
onPause() => voidundefinedCallback when pause is triggered
playbackRatenumber1Current playback speed multiplier
setPlaybackRate(rate: number) => voidundefinedCallback to change playback rate

Track Management Props

PropTypeDefault ValueDescription
autoRemoveEmptyTracksbooleantrueWhether to automatically remove empty tracks
onAutoRemoveEmptyTracksChange(enabled: boolean) => voidundefinedCallback when auto-remove setting changes
enableTrackDragbooleantrueWhether tracks can be reordered by dragging
enableMagneticTrackbooleantrueWhether items snap to track boundaries
enableTrackDeletebooleantrueWhether tracks can be deleted

Behavior Props

PropTypeDefault ValueDescription
hideItemsOnDragbooleantrue (desktop), false (mobile)Whether to hide items during drag operations

Undo/Redo Props (External)

PropTypeDefault ValueDescription
canUndobooleanundefinedWhether undo operation is available
canRedobooleanundefinedWhether redo operation is available
onUndo() => voidundefinedCallback to trigger undo
onRedo() => voidundefinedCallback to trigger redo

Aspect Ratio Props

PropTypeDefault ValueDescription
aspectRatioAspectRatioundefinedCurrent aspect ratio setting
onAspectRatioChange(ratio: AspectRatio) => voidundefinedCallback when aspect ratio changes

Prop Usage Examples

Essential Props

The minimum required props to get the timeline working:

<Timeline
  tracks={tracks}
  totalDuration={60}
  onTracksChange={setTracks}
/>

With Playback Control

Adding playback functionality:

<Timeline
  tracks={tracks}
  totalDuration={60}
  currentFrame={currentFrame}
  fps={30}
  isPlaying={isPlaying}
  onFrameChange={setCurrentFrame}
  onPlay={() => setIsPlaying(true)}
  onPause={() => setIsPlaying(false)}
  showPlaybackControls={true}
/>

With Selection Management

Handling item selection:

<Timeline
  tracks={tracks}
  totalDuration={60}
  selectedItemIds={selectedItems}
  onSelectedItemsChange={setSelectedItems}
  onItemSelect={(itemId) => console.log('Selected:', itemId)}
/>

With Full Event Handling

Complete event handler setup:

<Timeline
  tracks={tracks}
  totalDuration={60}
  onItemMove={handleItemMove}
  onItemResize={handleItemResize}
  onDeleteItems={handleDeleteItems}
  onDuplicateItems={handleDuplicateItems}
  onSplitItems={handleSplitItems}
  onAddNewItem={handleAddNewItem}
/>

With UI Controls

Enabling various UI features:

<Timeline
  tracks={tracks}
  totalDuration={60}
  showZoomControls={true}
  showPlaybackControls={true}
  showTimelineGuidelines={true}
  showUndoRedoControls={true}
  showAspectRatioControls={true}
/>

With Track Management

Configuring track behavior:

<Timeline
  tracks={tracks}
  totalDuration={60}
  enableTrackDrag={true}
  enableMagneticTrack={true}
  enableTrackDelete={true}
  autoRemoveEmptyTracks={false}
  onAutoRemoveEmptyTracksChange={setAutoRemoveEmptyTracks}
/>

With External Undo/Redo

Integrating with external undo/redo system:

<Timeline
  tracks={tracks}
  totalDuration={60}
  canUndo={historyManager.canUndo}
  canRedo={historyManager.canRedo}
  onUndo={historyManager.undo}
  onRedo={historyManager.redo}
  showUndoRedoControls={true}
/>

Type Definitions

TimelineTrack

interface TimelineTrack {
  id: string;
  name?: string;
  items: TimelineItem[];
  magnetic?: boolean;
  visible?: boolean;
  muted?: boolean;
}

TimelineItem

interface TimelineItem {
  id: string;
  trackId: string;
  start: number; // in seconds
  end: number;   // in seconds
  label?: string;
  type?: TrackItemType | string;
  color?: string;
  data?: any;
  // Media offset properties for split clips
  mediaStart?: number;
  mediaEnd?: number;
  mediaSrcDuration?: number;
}

AspectRatio

type AspectRatio = '16:9' | '9:16' | '1:1' | '4:3' | '3:4' | 'custom';

Next Steps