Props Reference

Complete reference for DotLottieSvelte component props with types and defaults, plus events emitted by the player instance.

The DotLottieSvelte component accepts the following props.

Props

PropTypeRequiredDefaultDescription
srcstring✔️undefinedSource URL or path to the .lottie or .json file
datastring | ArrayBufferundefinedAnimation data provided either as a Lottie JSON string or as an ArrayBuffer for .lottie animations
autoplaybooleanfalseWhether the animation plays automatically when loaded
loopbooleanfalseWhether the animation loops
loopCountnumber0Number of times the animation loops before stopping. 0 loops infinitely when loop is true
speednumber1Playback speed of the animation
mode"forward" | "reverse" | "bounce" | "reverse-bounce""forward"Animation play mode
segment[number, number]undefinedAnimation segment. An array of two numbers: start frame and end frame
markerstringundefinedNamed lottie marker to play
animationIdstringundefinedID of the animation to load from a multi-animation .lottie file
themeIdstringundefinedID of the dotLottie theme to initially use
themeDatastringundefinedRaw theme JSON string to apply directly, as an alternative to themeId
backgroundColorstringundefinedBackground color of the animation container. Accepts a 6-digit or 8-digit hex color string (e.g., "#000000", "#000000FF")
layoutobjectundefinedLayout configuration with fit and align properties. See Layout configuration
renderConfigobjectundefinedConfiguration for rendering the animation. See Render configuration
useFrameInterpolationbooleantrueWhether the animation updates on subframes. When false, the original After Effects frame rate is maintained, which can improve performance when subframe accuracy is not critical. When true, the animation refreshes on each requestAnimationFrame, including intermediate values
stateMachineIdstringundefinedID of the state machine to load on animation load
stateMachineConfigobjectundefinedSecurity configuration for the state machine. See StateMachineConfig
playOnHoverbooleanfalsePlays the animation when the cursor hovers over it and pauses when it leaves
stylestringundefinedStandard HTML style attribute applied to the player container
dotLottieRefCallback(dotLottie: DotLottie | null) => voidundefinedCallback that receives a reference to the underlying DotLottie player instance once instantiated

Example

<script lang="ts">
  import { DotLottieSvelte } from '@lottiefiles/dotlottie-svelte';
  import type { DotLottie } from '@lottiefiles/dotlottie-svelte';

  let dotLottie: DotLottie | null = null;
</script>

<DotLottieSvelte
  src="https://example.com/animation.lottie"
  autoplay
  loop
  speed={2}
  mode="bounce"
  segment={[10, 20]}
  backgroundColor="#f0f0f0"
  style="width: 300px; height: 300px;"
  dotLottieRefCallback={(ref) => dotLottie = ref}
/>

Events

The component does not emit Svelte events. Events are emitted by the underlying DotLottie instance, obtained through dotLottieRefCallback and subscribed to with addEventListener(event, listener).

EventDescription
readyWASM renderer is initialized
loadAnimation is loaded
loadErrorError loading animation
playAnimation starts playing
pauseAnimation is paused
stopAnimation is stopped
loopAnimation completes a loop
completeAnimation completes
frameAnimation reaches new frame
renderNew frame is rendered
freezeAnimation is frozen
unfreezeAnimation is unfrozen
destroyAnimation is destroyed
renderErrorRendering error occurred

Event payloads and state machine events are documented in the dotLottie web player events reference.

Last updated: August 13, 2026 at 9:17 AMEdit this page