Logoreact-timeline-editor
Core Concepts

Timeline Props

Complete props reference for the <Timeline /> component from @keplar-404/react-timeline-editor.

Required Props

PropertyTypeDescription
editorDataTimelineRow[](Required) Timeline editing data — the list of track rows
effectsRecord<string, TimelineEffect>(Required) Map of all possible effect instances

Scroll & Layout

PropertyTypeDefaultDescription
autoScrollbooleanfalseEnable auto-scroll during dragging near edges
styleCSSProperties--Custom inline style for the timeline wrapper
onScroll(params: OnScrollParams) => void--Scroll callback — use to sync sidebars
scrollTopnumber--@deprecated — use ref.setScrollTop instead

Scale & Display

PropertyTypeDefaultDescription
scalenumber1Duration (seconds) represented by one scale mark (>0)
scaleWidthnumber160Display width (px) of one scale mark (>0)
scaleSplitCountnumber10Number of subdivisions per scale mark (>0 integer)
minScaleCountnumber20Minimum number of scale marks shown (>=1)
maxScaleCountnumberInfinityMaximum number of scale marks (>=minScaleCount)
startLeftnumber20Left padding before the scale starts (px, >=0)
rowHeightnumber32Height of each row (px, >0)

Behavior & Interaction

PropertyTypeDefaultDescription
gridSnapbooleanfalseSnap action blocks to grid subdivisions
dragLinebooleanfalseShow auxiliary snap lines while dragging
hideCursorbooleanfalseHide the playback cursor line
disableDragbooleanfalseLock all action blocks — no dragging or resizing
autoReRenderbooleantrueAuto re-render when data or cursor time changes

Engine

PropertyTypeDefaultDescription
engineTimelineEnginebuilt-inProvide a custom TimelineEngine instance

Data Change

PropertyTypeDefaultDescription
onChange(editorData: TimelineRow[]) => boolean | void--Fired when an action operation ends. Return false to prevent automatic engine synchronization

Custom Renderers

PropertyTypeDescription
getActionRender(action: TimelineAction, row: TimelineRow) => ReactNodeCustom render function for action blocks
getScaleRender(scale: number) => ReactNodeCustom render function for scale ruler marks

New Fork Props

These props are exclusive to @keplar-404/react-timeline-editor:

PropertyTypeDefaultDescription
enableRowDragbooleanfalseEnable dragging to reorder entire track rows
enableCrossRowDragbooleanfalseEnable dragging action blocks between different rows
enableGhostPreviewbooleantrueShow a ghost/preview element following the cursor during cross-row block drag
getGhostPreview({ action, row }) => ReactNode--Custom ghost preview during cross-row drag

Action Move Callbacks

PropertyTypeDescription
onActionMoveStart(params: { action, row }) => voidFired when a block starts moving
onActionMoving(params: { action, row, start, end }) => boolean | voidFired during movement — return false to cancel
onActionMoveEnd(params: { action, row, start, end }) => voidFired when movement ends

Action Resize Callbacks

PropertyTypeDescription
onActionResizeStart(params: { action, row, dir }) => voidFired when resize starts
onActionResizing(params: { action, row, start, end, dir }) => boolean | voidFired during resizing — return false to cancel
onActionResizeEnd(params: { action, row, start, end, dir }) => voidFired when resize ends

Click & Context Callbacks

PropertyTypeDescription
onClickRow(e, { row, time }) => voidRow single-click
onClickAction(e, { action, row, time }) => voidAction block single-click
onClickActionOnly(e, { action, row, time }) => voidAction click — not fired when a drag was triggered
onDoubleClickRow(e, { row, time }) => voidRow double-click
onDoubleClickAction(e, { action, row, time }) => voidAction block double-click
onContextMenuRow(e, { row, time }) => voidRow right-click
onContextMenuAction(e, { action, row, time }) => voidAction right-click

Row Drag Callbacks

PropertyTypeDescription
onRowDragStart({ row }) => voidFired when a row drag starts
onRowDragEnd({ row, editorData }) => voidFired when a row drag drop completes — editorData is the reordered array

Cursor Callbacks

PropertyTypeDescription
onCursorDragStart(time: number) => voidFired when cursor drag begins
onCursorDragEnd(time: number) => voidFired when cursor drag ends
onCursorDrag(time: number) => voidFired continuously while cursor is dragged
onClickTimeArea(time, e) => booleanTime ruler click — return false to block cursor movement

Ref Handle (TimelineState)

Attach a ref to <Timeline /> to get imperative control:

const timelineRef = useRef<TimelineState>(null);
<Timeline ref={timelineRef} ... />
MemberTypeDescription
targetHTMLElement | nullThe underlying DOM node
listenerEmitter<EventTypes>Engine event emitter — use .on(...) to subscribe
isPlayingbooleanWhether timeline is currently playing
isPausedbooleanWhether timeline is paused
setTime(time)(time: number) => voidMove cursor to specific time
getTime()() => numberGet current cursor time
setPlayRate(rate)(rate: number) => voidSet playback speed multiplier
getPlayRate()() => numberGet current playback rate
reRender()() => voidRe-render at current time without playing
play(param)(param?: { toTime?, autoEnd?, runActionIds? }) => booleanStart playback
pause()() => voidPause playback
setScrollLeft(val)(val: number) => voidProgrammatic horizontal scroll
setScrollTop(val)(val: number) => voidProgrammatic vertical scroll

On this page