RVE LogoReact Video EditorDOCS
RVE SDK/Features/Tracks and items

Tracks and items

The EditorState data model — tracks, items, item types, and enter and exit animations

The editor keeps a project as one EditorState object. The state holds a list of tracks. Each track holds a list of items. An item is one clip on the timeline, for example a video, a text, or a shape.

EditorState
└── tracks: Track[]
    └── items: Item[]

All types on this page come from @reactvideoeditor/react-video-editor/types.

import {
  ItemType,
  type EditorState,
  type Track,
  type Item,
  type TextItem,
} from '@reactvideoeditor/react-video-editor/types';

EditorState

FieldTypeDescription
tracksTrack[]The tracks of the project, from the top track to the bottom track.
dimensions{ width: number; height: number }Optional. The composition size. If you do not set it, the editor uses 16:9 at 1280×720.
aspectRatioAspectRatioDeprecated. Use dimensions. The editor reads it only when dimensions is not set.
backgroundColorstringDeprecated. Use background.
backgroundCanvasBackgroundOptional. The background of the composition. It is not a timeline item.
playbackRatenumberThe playback speed.
savedAtnumberOptional. A Unix time in milliseconds. The editor sets it on each save.

Track

FieldTypeDescription
idstringA unique ID.
namestringOptional. The track name.
itemsItem[]The items on the track.
magneticbooleanIf true, the track closes the gaps between items.
mutedbooleanIf true, the track plays no sound.
visiblebooleanIf false, the track does not show.

The track order is the layer order. Track 0 shows in front of all other tracks.

Item types

The ItemType enum gives the type of each item:

Enum valueStringItem interface
ItemType.VIDEO'video'VideoItem (and CameraVideoItem)
ItemType.IMAGE'image'ImageItem
ItemType.TEXT'text'TextItem
ItemType.AUDIO'audio'AudioItem
ItemType.CAPTION'caption'CaptionItem
ItemType.SHAPE'shape'ShapeItem
ItemType.ZOOM'zoom'ZoomItem
ItemType.LOTTIE'lottie'LottieItem

Item is the union of all item interfaces.

Stickers were removed

The sticker item type was removed. You can still open a saved project that has sticker items. When the editor loads the project, it removes the sticker items. If a track holds only sticker items, the editor also removes that track.

Common fields (BaseItem)

All items have these fields:

FieldTypeDescription
idstringA unique ID (UUID).
typeItemTypeThe item type.
fromnumberThe start frame on the timeline.
durationInFramesnumberThe length of the item, in frames.
leftnumberThe X position on the canvas, in px.
topnumberThe Y position on the canvas, in px.
widthnumberThe width, in px.
heightnumberThe height, in px.
rotationnumberThe rotation, in degrees.
originXnumberOptional. The X point that keyframed scale, stretch, and rotation turn around, in % of the item box. Default: 50.
originYnumberOptional. The Y point for the same purpose. Default: 50.
keyframesItemKeyframesOptional. The animated properties of the item. See Keyframes.

Most items also have a styles object. All styles objects accept these base fields:

FieldTypeDescription
opacitynumberFrom 0 to 1.
zIndexnumberOptional layer index.
transformstringA CSS transform.
shadownumberShadow strength, from 0 (off) to 100.

Item fields by type

The tables below show the important fields of each item type. Read the type definitions in your IDE for the full list.

VideoItem

FieldTypeDescription
srcstringThe video URL.
contentstringThe thumbnail URL.
mediaStartTimenumberThe start point in the source, in seconds.
mediaSrcDurationnumberThe full length of the source, in seconds.
speednumberThe playback speed.
freezeFramebooleanIf true, the item holds the source frame at mediaStartTime for the full item length. The item plays no sound.
previewThumbnailsPreviewThumbnailsTimeline thumbnail files. If you set them, the editor does not download the video to make thumbnails.
transcriptTranscriptThe transcript of the audio. Captions and other transcript tools use it.
styles.volumenumberThe volume. 0 mutes the item.
styles.objectFit'contain' | 'cover' | 'fill' | 'none' | 'scale-down'How the video fills the item box.
styles.borderRadiusstringThe corner radius, for example '12px'.
styles.animationAnimationConfigThe enter and exit animations. See Animations.
styles.cropEnabled, cropX, cropY, cropWidth, cropHeightboolean, numberThe crop settings.

CameraVideoItem

A CameraVideoItem is a VideoItem with mediaRole: 'camera'. Its type is ItemType.VIDEO. The editor gives recorded camera clips a special panel, but it renders them as normal video. The optional camera object holds the camera shape ('square' | 'horizontal' | 'vertical' | 'original'), the shadow, the zoom, and the layout preset.

AudioItem

FieldTypeDescription
srcstringThe audio URL.
contentstringThe label on the timeline.
mediaStartTimenumberThe start point in the source, in seconds.
mediaSrcDurationnumberThe full length of the source, in seconds.
sourceVideoIdstringThe ID of the video that the audio came from, if you detached it.
styles.volumenumberThe volume.
styles.fadeInnumberThe fade-in length.
styles.fadeOutnumberThe fade-out length.

TextItem

FieldTypeDescription
contentstringThe text.
counterTextCounterOptional. If set, the item shows a counting number in place of content. See Count number.
styles.fontSizestringRequired. For example '4rem'.
styles.fontWeightstringRequired.
styles.colorstringRequired.
styles.backgroundColorstringRequired.
styles.fontFamilystringRequired.
styles.fontStylestringRequired.
styles.textDecorationstringRequired.
styles.textAlign'left' | 'center' | 'right'The alignment.
styles.lineHeight, styles.letterSpacingstringLine and letter spacing.
styles.textShadowstringA CSS text shadow.
styles.textStrokeWidthnumberThe outline width, in px. The editor paints the outline under the fill. 0 or no value shows no outline.
styles.textStrokeColorstringThe outline colour.
styles.animationAnimationConfigThe enter and exit animations.

ImageItem

FieldTypeDescription
srcstringThe image URL.
contentstringOptional. The thumbnail URL.
styles.objectFit'contain' | 'cover' | 'fill' | 'none' | 'scale-down'How the image fills the item box.
styles.borderRadiusstringThe corner radius.
styles.filterstringA CSS filter.
styles.animationAnimationConfigThe enter and exit animations.
styles.cropEnabled, cropX, cropY, cropWidth, cropHeightboolean, numberThe crop settings.

CaptionItem

FieldTypeDescription
captionsCaption[]The caption lines and their word timings.
templatestringOptional. The ID of the caption style template.
stylesCaptionStylesOptional. The caption styles.
sourceVideoIdstringThe ID of the video that the captions came from. The editor uses it to keep the captions in sync.

See Setup Captions for the caption styles.

ShapeItem

FieldTypeDescription
contentstringThe label on the timeline.
shapeShapeKind'rectangle' | 'ellipse' | 'arc' | 'line' | 'particles' | 'paper'. If you do not set it, the item is a rectangle.
styles.fillstringThe fill colour.
styles.gradientstring | ShapeGradientA linear or radial gradient. It replaces the fill.
styles.stroke, styles.strokeWidthstring, numberThe outline.
styles.borderRadiusstringThe corner radius of a rectangle.
styles.softEdgenumberThe blur of the edge, in px.
styles.dropShadowShapeShadowA drop shadow.
styles.arc, line, particles, paperobjectsThe settings of each shape kind.
styles.drawnumberThe drawn part of an arc or a line, from 0 to 100.

See Shapes for all shape settings.

LottieItem

FieldTypeDescription
srcstringThe URL of the Lottie JSON file.
contentstringThe label on the timeline.
loopbooleanOptional. Default: true.
speednumberOptional. From 0.5 to 2. Default: 1.
styles.opacitynumberThe opacity.
styles.animationAnimationConfigThe enter and exit animations.

ZoomItem

A zoom item does not show as a layer. It zooms the canvas while it plays.

FieldTypeDescription
contentstringThe label on the timeline, for example 'Zoom In'.
styles.zoomType'in' | 'out' | 'in-out' | 'shake' | 'follow'The zoom type. 'follow' follows the recorded pointer of a video item.
styles.zoomLevelnumberThe scale, for example 1.5 for 150%.
styles.targetX, styles.targetYnumberThe zoom centre, in %. Default: 50.
styles.easing'linear' | 'ease-in' | 'ease-out' | 'ease-in-out'The ease of the zoom.
styles.followPointerItemIdstringRequired when zoomType is 'follow'. The ID of the video item with pointer data.

Animations

Video, image, text, shape, and Lottie items have styles.animation. This object holds one enter animation and one exit animation.

interface AnimationConfig {
  enter?: string;          // The key of an enter animation, for example 'fade'
  exit?: string;           // The key of an exit animation
  enterTiming?: AnimationTiming;
  exitTiming?: AnimationTiming;
}

interface AnimationTiming {
  duration?: number;       // The length, in seconds
  delay?: number;          // The wait, in seconds
  ease?: AnimationEaseName;
}

type AnimationEaseName =
  | 'linear' | 'smooth' | 'out' | 'whip'
  | 'glide' | 'breathe' | 'back' | 'spring';
  • An enter animation starts after delay from the item start.
  • An exit animation ends delay before the item end.
  • If you do not set a timing field, the animation uses its default timing.
  • In the editor, the Animate tab of each item panel sets the animations. The Advanced controls set the duration (0.1 to 3 seconds), the delay, and the ease.

For more complex motion, use keyframes.

Example

import { ItemType, type EditorState } from '@reactvideoeditor/react-video-editor/types';

const editorState: EditorState = {
  dimensions: { width: 1920, height: 1080 },
  playbackRate: 1,
  tracks: [
    {
      id: 'track-1',
      magnetic: false,
      muted: false,
      visible: true,
      items: [
        {
          id: 'title-1',
          type: ItemType.TEXT,
          from: 0,
          durationInFrames: 90,
          left: 660,
          top: 450,
          width: 600,
          height: 180,
          rotation: 0,
          content: 'Hello',
          styles: {
            fontSize: '4rem',
            fontWeight: '700',
            color: '#ffffff',
            backgroundColor: 'transparent',
            fontFamily: 'Inter',
            fontStyle: 'normal',
            textDecoration: 'none',
            textAlign: 'center',
            animation: {
              enter: 'fade',
              enterTiming: { duration: 0.5, ease: 'out' },
            },
          },
        },
      ],
    },
  ],
};